PWP wiki processor

RemoteBackups

| StartPage | WikiPages | AdditionalFiles |

Syncing data between two machines
Using Rsync to sync directories on a single machine
Creating Remote Tar Archives
 -Notes

Remote backups to tape, or to a file are actually pretty easy to do in Unix/Linux. O'Reiley publishes a book called "Linux server hacks" that contains similar examples.

Syncing data between two machines

scp -C user@machine.ocean.dal.ca:/home/user/data/* .

rsync -ave ssh user@machine.ocean.dal.ca:/home/user/stuff .
(this one also prints stats to the screen, and uses compression):
rsync --stats --progress -avze ssh user@machine.ocean.dal.ca:/home/user/stuff .

#!/bin/bash
DAY=`date +%A`
rsync -ave ssh --delete user@machine.phys.ocean.dal.ca:/home/user/path \
 /home/local_user/path/current/
cp -a -l -f /home/local_user/path/current/dir /home/local_user/path/$DAY

0 3 * * * /home/user/cron_jobs/backup_script.sh

Using Rsync to sync directories on a single machine

rsync -av /home/user/bigDir /home/user/newdir

The previous command will recursively copy bigDir as a new subdirectory of newdir. This command is only slightly more complicated than the cp command.

Creating Remote Tar Archives

ssh fox.ocean.dal.ca "tar -cvf - junk/seistrans_test" > foo.tar

 ssh fox.ocean.dal.ca "cd /; tar -cvf - *" > foo.tar 

This example fetches a file from a remote server, compresses it on the local machine and saves the output:

ssh user@machine.ocean.dal.ca "cat /dir/file.sgy" | bzip2 --stdout > file.sgy.bz2

tar -cvf - xyz2clar/ | ssh fox.ocean.dal.ca "cat > foo2.tar"

tar -zcvf - xyz2clar/ | ssh fox.ocean.dal.ca "cat > foo2.tar.gz"

mt -f /dev/st0 setblk 0
ssh user@machine.ocean.dal.ca "cd /; tar -cvf - *" > /dev/st0

mt -f /dev/st0 setblk 0
ssh user@machine.ocean.dal.ca "cd /; tar -xvf -" < /dev/st0

Notes

   (Powered by PWP Version 1-4-3 )