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.

Attachment: pgpgBHPOGBgb5.pgp
Description: PGP signature

Reply via email to