#!/usr/bin/perl # # include: nice -n 19 /usr/local/bin/runjobsof -f /etc/crontab -r ipacsum & # in /etc/rc.d/rc.sysinit # so script is run at start up # my($line,$i); if(lc($ARGV[0]) eq "-f" && lc($ARGV[2]) eq "-r" && $#ARGV == 4){ open(FH, $ARGV[1]) || die "Can't open $ARGV[1]\n"; while(!eof(FH)){ $line = ; if($line =~ /^.*[^#].*$ARGV[3].*/){ $line =~ /(\S*$ARGV[3].*)/; system($1); #print "$1\n"; } } close(FH); }else{ print "Usage: runjobsof -f FILE -r SCRIPT\n". "Use this to run scripts that are not run due to machine being off.\n". " -f FILE specify the location of the crontab, ie. /etc/crontab\n". " -r SCRIPT will run any entries in crontab that include SCRIPT\n". "Calling the script with any other option will display this help\n". "Note: options must be in order shown in usage.\n"; }