Monday, August 20, 2007

run-parts scripts: a note about naming

run-parts is used (on Debian systems, anyway) to run the scripts in /etc/cron.daily (hourly, weekly, etc) on the appropriate schedule. I had trouble this week with a Perl script I’d dropped into /etc/cron.daily failing to run. Ran fine from the command line, of course. Odd.



Eventually it occurred to me, after a little light man page reading, to try run-parts --test /etc/cron.daily (which just prints the names of the scripts that would run). Script failed to show up. Most Odd.



I finally found the answer via Google, although a slightly less
light reading of the man page would have helped. Scripts to be run by
run-parts must adhere to a particular naming convention - in
particular, no .xx endings. So my script.pl script wasn’t being picked up due to that .pl ending. I renamed it to script and all was well.



(I’m not actually sure what the logic of this is; I’m assuming it’s likely to be historical reasons. You can alter it with the --lsbsysinit option, if you prefer that. I know the .xx ending is by no means essential, but I prefer in general to have a quick visual of what language I’ve written a script in.)



Powered by ScribeFire.

No comments: