In addition to Tony's excellent suggestion... It's possible for certain things to go haywire when there's no terminal attached. It might help if you do this in the crontab entry
0 19 * * 1-5 /etc/cdbackup </dev/null >/tmp/log 2>&1 This isn't guaranteed though. Another gotcha is the lack of environment variables you might be expecting (eg PATH, HOME). Setup a simple cron job that does 'set>/tmp/envstuff' and compare with the result of 'set' from your command prompt. On Wed, 9 Jul 2003, Craig Mead wrote: > G'day, > > Explanation.... > > Got a cron job which runs @ 7pm every week night to backup folders in > /home/shares (smb shares). > When run manually (/etc/cdbackup) everything works fine, and the CD burns > with the right datestamps on the tar files. > > The cron job does run, cause theres an eject /cdrom line at the end of the > script, and the CD does eject itself. > > However when left to its own devices it doesn't appear that nothing gets > written to the CD, even tho the output off the screen is the same as when > executed manually. > > Related files for reference are below > > TIA. > > > --- start /etc/cdbackup dump --- > > #!/bin/bash > > DOCOMPRESS=YES > DOIMAGE=YES > DOBURN=YES > > clear > echo -e "================ COMMENCING DAILY BACKUP =================\n\n" > > cd /home/shares > rm -f *.cd > rm -f *.tar > touch `date +%a-%d%m`.cd > > if [ $DOCOMPRESS = "YES" ] > then > echo -e "Compressing ...." > echo -e " Store1 Data" > tar czf store1.tar store1/ > echo -e ".... Finished\n" > fi > > if [ $DOIMAGE = "YES" ] > then > echo -e "Deleting previous nights CD Image File...." > rm -f cdimage.raw > echo -e "Creating CD Image File...." > mkisofs -R -o cdimage.raw *.tar > fi > > if [ $DOBURN = "YES" ] > then > echo -e "Writing CD...." > cdrecord -v -eject speed=4 blank=fast dev=0,0,0 cdimage.raw > wait > umount /cdrom > eject /cdrom > fi > > echo -e ".... Finished\n" > echo -e "Backup Completed" > backup.log > date >> backup.log > > echo -e "=================\n\n" > cd - > > --- end /etc/cdbackup dump --- > > > --- start /var/spool/cron/crontabs/root --- > > # DO NOT EDIT THIS FILE - edit the master and reinstall. > # (/tmp/crontab.XXXX81mSF5 installed on Wed Jul 9 14:36:22 2003) > # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) > 0 19 * * 1-5 /etc/cdbackup > > --- end /var/spool/cron/crontabs/root --- > > > -- ---<GRiP>--- Grant Parnell - senior consultant EverythingLinux services - the consultant's backup & tech support. Web: http://www.everythinglinux.com.au/services We're also busybits.com.au and linuxhelp.com.au. Phone 02 8752 6622 to book service or discuss your needs. -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
