Danny, On Wednesday 04 August 2004 11:15, Danny Sauer wrote:
Anders wrote regarding 'Re: [SLE] Pullin' my hair out... arrrgh' on Wed, Aug 04 at 12:50:
...
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
You probably want this: echo "$@" |at now + 18 hours The quotes are always advisable and should there be any arguments, presumably you'd want them passed on as well.
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
Here documents are cool, but they make scripts harder to read and understand, so I avoid using them unless they're really necessary. Randall Schulz