Here follows the magic.
As an example the cronjob entry is something similar to:
# run every 30 minutes at top and bottom of every hour of every day
0,30 * * * * bash -l -c 'WittCron01' >> /dev/null 2>&1
cat WittCron01
#!/bin/bash
# top priority cron job - kill any already running Automate scripts - start Automate
# kill any instances of Automate
pkill -f Automate
# start an independent instance of Automate
(( DISPLAY=:0 Automate 0<&- &>/dev/null &) &)
# give that instance of Automate some time to prove it can stay alive :)
sleep 10
# if Automate is still running after the above sleep 10
# then kill this and all instances of WittCron01
# else start a new instance of WittCron01
pgrep -f Automate && pkill -f WittCron01 || WittCron01
There you go.
No comments:
Post a Comment
This is Charles Weldon Witt. Thank you for commenting on my blog.