[Wylug-help] Sh problem

Stephen Patterson steve at patter.mine.nu
Thu Apr 17 11:32:04 BST 2008


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)

-- 
Stephen Patterson :: steve at patter.mine.nu :: http://patter.mine.nu/
GPG: B416F0DE :: Jabber: patter at jabber.earth.li 
"Don't be silly, Minnie. Who'd be walking round these cliffs with a gas oven?"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://list.wylug.org.uk/pipermail/wylug-help/attachments/20080417/82b37a8b/attachment.bin


More information about the Wylug-help mailing list