Page 1 of 1

support for @reboot command in cron

PostPosted: Sun Oct 27, 2013 9:39 am
by firwareslut
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?

Re: support for @reboot command in cron

PostPosted: Sun Oct 27, 2013 10:16 am
by Jocko
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)

Re: support for @reboot command in cron

PostPosted: Sun Oct 27, 2013 10:24 am
by firwareslut
Only the reboot command is personally interesting to me. I know how to configure cron for the time based settings :)

Re: support for @reboot command in cron

PostPosted: Sun Oct 27, 2013 12:21 pm
by Mijzelf
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?

Re: support for @reboot command in cron

PostPosted: Mon Oct 28, 2013 7:40 am
by firwareslut
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?

Re: support for @reboot command in cron

PostPosted: Mon Oct 28, 2013 8:53 am
by Mijzelf
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.

Re: support for @reboot command in cron

PostPosted: Mon Oct 28, 2013 9:24 am
by Jocko
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 ;)

Re: support for @reboot command in cron

PostPosted: Sun Dec 01, 2013 9:53 am
by Jocko
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

Re: support for @reboot command in cron

PostPosted: Mon Dec 02, 2013 5:57 am
by firwareslut
Looks really awesome! Thanks very much :D I am sure many will find it useful :)