running as overnight cron job

Lee Sonko (lee@networks.bgs.com)
Thu, 3 Apr 1997 11:15:47 -0500 (EST)


This might be appropriate to put on the web page.

At my office, I can't run deschall during the day so I have set up some cron jobs
to start in the evening and have the output emailed to me. Although these scripts are
'trivial' to a unix sysadmin, it might be useful if I posted what I wrote so others
can work from it.

script "desstart"
----------------------
#!/bin/sh

/[desdirectory]/desrun 2>&1 | /usr/bin/mailx -s "DES hunting `/usr/bin/date +%D` on `/usr/bin/hostname`" [person@running.deschall.com]
----------------------

script "desrun"
----------------------
#!/bin/sh
ECHO="/usr/bin/echo"
$ECHO "hostname = `/usr/ucb/hostname`"
$ECHO "start time = `/usr/bin/date`"
$ECHO " "
/[desdirectory]/deschall keymaster.verser.frii.com
$ECHO " "
$ECHO "end time = `/usr/bin/date`"
----------------------

script "desstop"
----------------------
#!/bin/sh

# kill all jobs that have the word "deschall" in them
/usr/bin/kill `/bin/ps -e -o pid -o args | /usr/bin/grep deschall | /usr/bin/grep -v grep | /usr/bin/cut -b1-5`
----------------------

crontab file (this is for a dual processor machine.. start one at 8pm, a second at midnight. Then kill 'em both at 5am. On the weekends, run longer)
----------------------
#
# minute hour day month day (0=sun)
#
# Weekdays
0 20 * * 1-5 /net/beakman/home/lee/cron/desstart
0 0 * * 1-5 /net/beakman/home/lee/cron/desstart
0 5 * * 1-5 /net/beakman/home/lee/cron/desstop
#
# Weekends
0 18 * * 0,6 /net/beakman/home/lee/cron/desstart
0 0 * * 0,6 /net/beakman/home/lee/cron/desstart
0 8 * * 0,6 /net/beakman/home/lee/cron/desstop
#
#
----------------------

enjoy,
Lee Sonko