public
Created

simple crontab shell driver

  • Download Gist
silv-crontab.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/bash
 
function die () {
echo "$*" >&2
exit 1
}
 
basedir=$(dirname "$0")
basedir=$(readlink -f "$basedir")
cd "$basedir" || die "cannot hop into $basedir"
 
unset MODULEBUILDRC
unset PERL_MM_OPT
unset PERL5LIB
export PATH='/home/whatever/silv/perl-5.14.2/bin:/home/whatever/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin'
 
date=$(date '+%Y-%m-%d')
logfile="log/SILV-$date.log"
/home/whatever/silv/perl-5.14.2/bin/perl -I lib bin/silv -c etc/field.conf >"$logfile" 2>&1
 
# cleanup older runs
find "log" -type f -name 'SILV-*.log' -not -newermt '-60 days' -delete

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.