Anders wrote regarding 'Re: [SLE] Pullin' my hair out... arrrgh' on Wed, Aug 04 at 12:50:
On Wednesday 04 August 2004 19:22, C Hamel wrote:
I need a script to execute every 18 hours w/o having to change the crontab daily, if possible. I have tried sleeping/recalling script but, of course, one has to then kill a bunch of pids for older executions of the same script ...but at least not daily, I don't suppose.
Is there a cleaner way of doing this?
finish the script with something like
cat << EOF |at now + 18 hours /usr/bin/scriptname EOF
I'm partial to echo $0 | at now + 18 hours since it continues to work even if the script gets moved/renamed and I forget to change self references inside the script. Data duplication is bad. ;) This is assuming the use of a shell that puts the command in $0, obviously. It might be a good idea to touch a file (/var/state/scriptname, perhaps) to ensure that the script's running periodically, and have a cron job that sends a warning email if that file's older than 18 hours or so... --Danny, who also dislikes here documents, in general