#!/bin/sh
##############################################################################
# ----[ editcron.sh ]----
# script to keep cronjobs persistent (e.g. after reboot)
# NOTE:  put this in /mnt/HD_a2/ffp/start/ and make it executable.
# w 22/10/08 horto 
# ref/credit: http://tinyurl.com/5m2349 - thanks chumby!
#############################################################################
FFP=/mnt/HD_a2/ffp
CRONTXT=$FFP/etc/crontab.txt

# start with existing crontab
# note:  on a fresh reboot, this will always have been reset to standard
/bin/crontab -l > $CRONTXT

# add cronjobs here preceeded by /bin/echo.  
# don't forget to enclose them in double quotes.
/bin/echo "0 * * * * /ffp/var/scripts/torrentwatchdog.sh >> /mnt/HD_a2/logs/torrentwd.log 2>&1" >> $CRONTXT
/bin/echo "30 3 * * * /ffp/var/scripts/unpacker.sh >> /mnt/HD_a2/logs/unpack.log 2>&1" >> $CRONTXT

# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

