[Wylug-help] Sh problem

Anne Wilson cannewilson at googlemail.com
Thu Apr 17 11:51:17 BST 2008


On Thursday 17 April 2008 11:32, Stephen Patterson wrote:
> On 17 Apr 08, Anne Wilson (cannewilson at googlemail.com) wrote:
> > Here is the actual script:
> > sudo /bin/bash
> > cd /
> > tar cvpzf /media/USB%20Flash%20Memory/partition1/EeePC(date
> > +%F).tar.gz --exclude=/media* --exclude=/proc/* --exclude=/lost+found/*
> > --exclude=/mnt/* --exclude=/sys/* --exclude=/home.* /
> >
> > It looks as though it's something to do with the date parameter,but (date
> > +%F) is all on one line, not as it shows here.
>
> Sudo really only works well with 1-liners, such as the one I use below
> for some backups,
>
> sudo rsync /media/home/ 192.168.1.1::home -av --delete --exclude=backups
>
> so, write your backup script as
> #!/bin/bash
> cd /
> export PWD
> tar cvpzf /media/USB%20Flash%20Memory/partition1/EeePC(date +%F).tar.gz
> --exclude=/media* --exclude=/proc/* --exclude=/lost+found/*
> --exclude=/mnt/* --exclude=/sys/* --exclude=/home.* /
>
> then run the script itself through sudo.
>
> (may not need to export PWD)

Hmm - that's got rid of some problems, but now it can't find the target:

tar: /media/USB%20Flash%20Memory/partition1/EeePC2008-04-17.tar.gz: Cannot 
open: No such file or directory

Anne



More information about the Wylug-help mailing list