have a linux machine running suse that i was trying to use as backup machine
i was running a script on there
Code:
#/bin/sh
mkdir - p /backups/
cd /backups/
scp -r 10.0.6.22:/temp/backups
the script work fine and just bulls across the data.
thing is the data been pulled across is not to big for the hd on the box. how would i go about connecting an external hd and then modifying the script?
TIA
wait hang on...
make a directory, cd to it, then copy the contents of a remote folder to the directory you just made... if you're going to run this more than once, then surely the folder exists, thererfore the first line is redundant?
Anyway... if you don't every power off the suse box, then simply mount the external disk on /backups, cut the first line of the script any off you go.
plug in usb drive
Code:
$ dmesg | tail | grep /dev/
will tell you the device node for the external disk
Code:
# mount /$DEVICE /backups
- where $DEVICE is the /dev/XXXX bit from the previous command - will mount the drive (if the external drive is ntfs, that will mount read-only - if it's ntfs, then use
Code:
# mount /dev/$DEVICE /backups -t ntfs-3g
and off you go.
If you need to reboot the box, then you'll either need to run that *every* time, or either add an entry to fstab or configuring hal.
fstab would look something like this and would rely on you either issuing the mount command or having the disk in when booting. HAL is generally better - but can have problems mounting ntfs read-write.
Code:
UUID=$UUID_OF_YOUR_DISK /backups $YOUR_FILESYSTEM user,rw 0 0
Best to use the uuid, as the device node may change depending on what else you have plugged in. you can find that with
Because of the "user,rw" options in that line, you can mount the disk in the right place as a user when you plug it in with
EDIT: Actually - you could add that to your script.
Or something like that.
If Linux was a car, then it would have eighteen steering wheels and no air conditioning, but you'd be able to change the radio station from the hubcaps