Page 1 of 1

[solved] Multiple scheduled actions at different times

Posted: 27 Oct 2017, 20:32
by kryptus
If I wanted to do 2 different things at 2 different times, for example restart the browser ar 5PM and reboot the PC at 4AM what would I put in scheduled_actions? I just thought I could write a script that checks the time - but is there a simpler way?

Multiple scheduled actions at different times

Posted: 28 Oct 2017, 07:06
by fanthom
You can use following syntax for the action:

Code: Select all

command1; sleep $x; command2; sleep $x; command3
Example:

Code: Select all

scheduled_action=Monday-10:00 Tuesday-10:00 Wednesday-10:00 Thursday-10:00 Friday-10:00 Saturday-10:00 Sunday-10:00 action:killall chrome; sleep 270m; killall chrome; sleep 4h; halt
If you need full cron functionality (different actions per day of month/year, etc) then you can inject cron jobs directly to the crontab using run_command parameter:

Code: Select all

run_command=echo '0 9 * * 1-5 root command' >> /etc/crontab; echo '0 10 * * SAT,SUN root command' >> /etc/crontab
Thanks