OK. I echoed every line that is to be run before it is run. I know it looks like commands take up more than one line, but they don't - it's just the text wrap. Here's the script:
#!/bin/bash rm -r /home/amy/.Trash rm -r /home/amy/.thumbnails rm -r /home/michael/.Trash rm -r /home/michael/.thumbnails today=`date '+%m%d%y'` # Backup all echo Backing up both /home/amy and /home/michael # michael section filename=/backup/baby-gentoo-michael-$today.tar.bz2 echo find /home/michael -daystart -type f -mtime 1 > /home/michael/system/iBackup_list find /home/michael -daystart -type f -mtime 1 > /home/michael/system/iBackup_list echo tar -c -v --file=$filename -j --files-from=/home/michael/system/iBackup_list tar -c -v --file=$filename -j --files-from=/home/michael/system/iBackup_list echo Backup of /home/michael complete # amy section filename=/backup/baby-gentoo-amy-$today.tar.bz2 echo find /home/amy -daystart -type f -mtime 1 > /home/michael/system/iBackup_list find /home/amy -daystart -type f -mtime 1 > /home/michael/system/iBackup_list echo tar -c --file=$filename -j --files-from=/home/michael/system/iBackup_list tar -c --file=$filename -j --files-from=/home/michael/system/iBackup_list echo Backup of /home/amy complete filename=/backup/baby-gentoo-etc-$today.tar.bz2 echo find /etc -daystart -type f -mtime 1 > /home/iBackup_list find /etc -daystart -type f -mtime 1 > /home/iBackup_list echo tar -c -j --file=$filename --files-from=/home/iBackup_list tar -c -j --file=$filename --files-from=/home/iBackup_list echo Backup of /etc complete cp /var/lib/portage/world /backup And here's the output in the cron report: rm: cannot remove `/home/amy/.Trash': No such file or directory rm: cannot remove `/home/amy/.thumbnails': No such file or directory rm: cannot remove `/home/michael/.thumbnails': No such file or directory Backing up both /home/amy and /home/michael tar -c -v --file=/backup/baby-gentoo-michael-011105.tar.bz2 -j --files-from=/home/michael/system/iBackup_list tar: Too few arguments; will not create an empty archive. Usage: tar cmd [options] file1 ... filen Use tar -help and tar -xhelp to get a list of valid cmds and options. Use tar H=help to get a list of valid archive header formats. Use tar diffopts=help to get a list of valid diff options. Backup of /home/michael complete tar -c --file=/backup/baby-gentoo-amy-011105.tar.bz2 -j --files-from=/home/michael/system/iBackup_list tar: Too few arguments; will not create an empty archive. Usage: tar cmd [options] file1 ... filen Use tar -help and tar -xhelp to get a list of valid cmds and options. Use tar H=help to get a list of valid archive header formats. Use tar diffopts=help to get a list of valid diff options. Backup of /home/amy complete tar -c -j --file=/backup/baby-gentoo-etc-011105.tar.bz2 --files-from=/home/iBackup_list tar: Too few arguments; will not create an empty archive. Usage: tar cmd [options] file1 ... filen Use tar -help and tar -xhelp to get a list of valid cmds and options. Use tar H=help to get a list of valid archive header formats. Use tar diffopts=help to get a list of valid diff options. Backup of /etc complete I know that I can use a switch to turn off those warnings about the directories I'm trying to delete not existing, but I like them there. And as I said, the script works just fine when run in a terminal window. So why is it tripping? -Michael Sullivan- On Sat, 2005-01-08 at 20:05 +0100, [EMAIL PROTECTED] wrote: > On 08-01-05 10:28 -0600, Michael Sullivan wrote: > > I'm having issues with my backup scripts. I wrote both backup scripts > > back when I was using FC1 on my client PC. One is a full backup of two > > user accounts in /home and then /etc and the other creates a list of > > files created/modified the date before the script is run and then only > > backs those files up. Full backup is on Sunday; every other day gets > > iBackup. They're listed in the crontab to run at 3am. The trouble is > > each morning when I'm reading my cron report for the backup it says that > > there was a problem with tar in my script, but when I run the script > > from the command line as root it works fine. I scheduled the script in > > root's (su -) crontab. Here is the /home/michael/system/iBackup script: > > > > #!/bin/sh > > > > rm -r /home/amy/.Trash > > rm -r /home/amy/.thumbnails > > rm -r /home/michael/.Trash > > rm -r /home/michael/.thumbnails > > > > today=`date '+%m%d%y'` > > > > # Backup all > > echo Backing up both /home/amy and /home/michael > > > > # michael section > > filename=/backup/baby-gentoo-michael-$today.tar.bz2 > > find /home/michael -daystart -type f -mtime 1 > > > /home/michael/system/iBackup_list > > tar -c --file=$filename -j > > --files-from=/home/michael/system/iBackup_list > > echo Backup of /home/michael complete > > > > # amy section > > filename=/backup/baby-gentoo-amy-$today.tar.bz2 > > find /home/amy -daystart -type f -mtime 1 > > > /home/michael/system/iBackup_list > > tar -c --file=$filename -j > > --files-from=/home/michael/system/iBackup_list > > echo Backup of /home/amy complete > > > > filename=/backup/bullet-etc-$today.tar.bz2 > > find /etc -daystart -type f -mtime 1 > /home/iBackup_list > > tar -c -j --file=$filename --files-from=/home/iBackup_list > > echo Backup of /etc complete > > > > cp /var/lib/portage/world /backup > > > > > > And here is the contents of the cron report: > > > > rm: cannot remove `/home/amy/.Trash': No such file or directory > > rm: cannot remove `/home/michael/.Trash': No such file or directory > > Backing up both /home/amy and /home/michael > > tar: Too few arguments; will not create an empty archive. > > Usage: tar cmd [options] file1 ... filen > > > > Use tar -help > > and tar -xhelp > > to get a list of valid cmds and options. > > > > Use tar H=help > > to get a list of valid archive header formats. > > > > Use tar diffopts=help > > to get a list of valid diff options. > > Backup of /home/michael complete > > tar: Too few arguments; will not create an empty archive. > > Usage: tar cmd [options] file1 ... filen > > > > Use tar -help > > and tar -xhelp > > to get a list of valid cmds and options. > > > > Use tar H=help > > to get a list of valid archive header formats. > > > > Use tar diffopts=help > > to get a list of valid diff options. > > Backup of /home/amy complete > > tar: Too few arguments; will not create an empty archive. > > Usage: tar cmd [options] file1 ... filen > > > > Use tar -help > > and tar -xhelp > > to get a list of valid cmds and options. > > > > Use tar H=help > > to get a list of valid archive header formats. > > > > Use tar diffopts=help > > to get a list of valid diff options. > > Backup of /etc complete > > > > > > It confuses me because the script runs without complaint when I su - to > > root and run it. Any ideas how I can make this work? > > > > > > -- > > [email protected] mailing list > > > > It looks like you have the files on a separate line. > Although that's probably just wrapping. > > And I'd add -f to the rm commands to avoid the warnings. > > Try using #!/bin/bash instead. > > Oh, and try echoing the lines it runs before it does. -- -- [email protected] mailing list
