Backup RAWDAT on all machines and send to Sorcerer
This script logs onto each computer, makes a tar of the RAWDAT files
and sends a bzip2 back to Sorcerer.
#!/bin/bash
## This program logs onto each computer and
makes a tar of the RAWDATA
## The tar file is then zipped and copied back to Sorcerer
## Must be logged in as pmag or else!
LAB=/Desktop/LabVIEW-Data-`date "+%C%y%m%d"`.tar
MINI=/Desktop/MINISPIN-RAWDAT-`date "+%C%y%m%d"`.tar
AMS=/Desktop/KAPPABRIDGE-RAWDAT-`date "+%C%y%m%d"`.tar
echo "MAKING TAR ON PIXIE"
ssh pixie "tar cf ~$LAB ~/Documents/LabVIEW\ Data/"
echo "ZIPPING TAR ON PIXIE"
ssh pixie "bzip2 -9 ~$LAB"
echo "TRANSFERING TO SORCERER"
scp pixie:~$LAB.bz2 ~/Desktop/TAR-BZ2
ssh pixie "cd ~/Desktop ; rm ~$LAB.bz2"
echo "MAKING TAR ON ANORTHITE"
ssh anorthite "tar cf ~$MINI ~/Documents/MINISPIN-RAWDAT"
echo "ZIPPING TAR ON ANORTITE"
ssh anorthite "bzip2 -9 ~$MINI"
echo "TRANSFERING TO SORCERE"R
scp anorthite:~$MINI.bz2 ~/Desktop/TAR-BZ2
ssh anorthite "cd ~/Desktop ; rm ~$MINI.bz2"
echo "MAKING TAR ON SOOTHSAYER"
ssh soothsayer "tar cf ~$AMS ~/Documents/KAPPABRIDGE-RAWDAT"
echo "ZIPPING TAR ON SOOTHSAYER"
ssh soothsayer "bzip2 -9 ~$AMS"
echo "TRANSFERING TO SORCERER"
scp soothsayer:~$AMS.bz2 ~/Desktop/TAR-BZ2
ssh soothsayer "cd ~/Desktop ; rm ~$AMS.bz2"
The trick to this was being able to log onto the computers
without being asked for a password so backups can be run through a
crontab. The command to do this is
ssh-kegen -t dsa
This creates public/private keys in the .ssh/. The
id_dsa.pub is your public key. This file has to be copied into .ssh/
of the machine which it wants to log into and called authorized_keys.
So, when Sorcerer ssh's into select computer's, it's fingerprint is
already known through an authorized_key and you are not asked for a
password.