From: Michael Havens
> Okay Matt (or anyone else who wants to answer this), could I do this:
> first I make a directory in the usb [disk] called 'bmike1-backup'
>
> #!/bin/bash
> sudo mkdir /backups
> sudo mount /sdc1/backup-bmike1 /backups
> rsync -av /home/bmike1
> sudo umount backups; sudo rmdir backups <-make everything like it was
Why all the sudo invocations? The procedure I gave earlier only requires 2
things to be done as root: Make a mountpoint for the device, then add an
fstab entry for that device. Do those things and then you can back up your ~
as a normal user, no root anything required.
Also, your mount syntax in that script is incorrect unless your distro is
doing something very odd. And USB devices are not guaranteed to have the same
device names; the USB disk at /dev/sdc1 may be /dev/sdd1 or /dev/sdb1
depending on how many other USB storage devices are plugged in. That's why I
said you should make a filesystem with a label on it. Do that on your USB
disk. If it already has a filesystem on it, you can do "tune2fs -L
A_NEW_LABEL /dev/whatever" to change the filesystem label without zorching the
filesystem.
Once you've done these things, the script would look like this:
#!/bin/bash
mount /mnt/backup
if mount | grep /mnt/backup > /dev/null ; then
rsync -av --delete-after /home/bmike1/ /mnt/backup/bmike1
umount /mnt/backup
else
echo "backup disk not mounted; can't back up"
fi
--
Matt G / Dances With Crows
The Crow202 Blog:
http://crow202.org/wordpress/
There is no Darkness in Eternity/But only Light too dim for us to see
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss