support for @reboot command in cron

support for @reboot command in cron

Postby firwareslut » Sun Oct 27, 2013 9:39 am

Cron has some cool commands that the NAS cron creator doesn't seem support

@yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
@monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
@weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
@daily Run once a day at midnight 0 0 * * *
@hourly Run once an hour at the beginning of the hour 0 * * * *
@reboot Run at startup @reboot

Quick solution would be to allow the user to paste their own cron command in the generate cron job text area.

I think the @reboot would be a very nice and clean addition for user startup scripts for the NAS

Does the current cron binary support it?
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am

Re: support for @reboot command in cron

Postby Jocko » Sun Oct 27, 2013 10:16 am

Hi firwareslut,

I don't understand well.

Currently, the firmware supports 'fakely' these keywords : @yearly ;@monthly ;@weekly Run ;@daily Run ;@hourly .

Only the keyword @reboot is not yet implemented.

Currently, I am not sure that install an other cron allows to use this keyword. I think that we must look on the side kernel and PCB.

only a test can confirm that.

otherwise: to use the other kerwords see the help page:
Note : In the Minute dropdown list you can also select the equivalents of the keywords : @yearly, @monthly, @weekly, @daily and @hourly. ( and the other dropdown list are then desactivated)
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: support for @reboot command in cron

Postby firwareslut » Sun Oct 27, 2013 10:24 am

Only the reboot command is personally interesting to me. I know how to configure cron for the time based settings :)
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am

Re: support for @reboot command in cron

Postby Mijzelf » Sun Oct 27, 2013 12:21 pm

Executing something @reboot is the same as an /etc/init.d startscript, I guess? Or is it only executed @reboot and not on a cold start?
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: support for @reboot command in cron

Postby firwareslut » Mon Oct 28, 2013 7:40 am

It is executed on cold and reboot. I didn't think it was that easy to initiate a startup script on the firmware and that it was all loaded from a database on boot?
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am

Re: support for @reboot command in cron

Postby Mijzelf » Mon Oct 28, 2013 8:53 am

Actually I don't know, but I'm sure Jocko or fvdw knows. I guess there is an /etc/rc.local or something which behaves the same.
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: support for @reboot command in cron

Postby Jocko » Mon Oct 28, 2013 9:24 am

Yes, we could implement a new feature to add some custom shell scripts at boot and/or at reboot.
So maybe something to add in the Todo list (version 16.0 ?)

This will be done without using crond ;)
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: support for @reboot command in cron

Postby Jocko » Sun Dec 01, 2013 9:53 am

In the next version 15.1, this new feature is now implemented (not with cron) :mrgreen:

Here the new menu:
bootjob.jpg


And in the boot log you have this trace type (it's an example with two custom scripts!):
Code: Select all
...
executing user boot commands

   Mount system partitions on Projet
   /share/1000/fvdw/cron-boot/mount.sh
      Mount sda1:   [ OK ]
      Mount sda2:   [ OK ]
      Mount sda5:   [ OK ]
      Mount sda7:   [ OK ]

   Restore my custom menus
   /share/1000/fvdw/cron-boot/restore-myphp.sh
      Already updated !

user boot commands ended
You do not have the required permissions to view the files attached to this post.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: support for @reboot command in cron

Postby firwareslut » Mon Dec 02, 2013 5:57 am

Looks really awesome! Thanks very much :D I am sure many will find it useful :)
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am


Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 6 guests