Tue Jun 28 14:51:31 PDT 2005

hidden files

To run programs from anywhere within the terminal, three (hidden) files must be placed in the user's directory. The first file should be called .bashrc and looks like the following
if [ -f /sw/bin/init.sh ]; then
  . /sw/bin/init.sh
fi
The second file should be called .bash_profile
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi
export BASH_ENV=$HOME/.bashrc
The third hidden file should be called .profile
test -r /sw/bin/init.sh && . /sw/bin/init.sh

Posted by Jason Steindorf | Permalink | Categories: computers

Fri Mar 18 19:45:35 PST 2005

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.

Posted by Jason Steindorf | Permalink | Categories: computers

Wed Mar 16 13:44:20 PST 2005

Keeping removable media mounted on logout

In OSX 10.3, removable media is unmounted when nobody is logged in. To correct this, the following command must be executed.
sudo defaults write \
/Library/Preferences/SystemConfiguration/autodiskmount \
AutomountDiskWithoutUserLogin -bool true
Removable media sources (i.e. FireWire) now stay mounted without being logged in allowing the daily_backup.bash script to run through the crontab

Posted by Jason Steindorf | Permalink | Categories: computers

Tue Mar 15 07:37:59 PST 2005

daily backup script


#!/bin/bash
## This program backs up the RAWDAT and PDFs on Sorcerer to an
external hard drive FireWire

echo "COPYING RAWDAT TO FIREWIRE"
cp -R ~pmag/RAWDAT /Volumes/FireWire/daily_backup/07
echo "COPYING PDFs TO FIREWIRE"
cp -R ~pmag/Documents/pdfs /Volumes/FireWire/daily_backup/06-pdfs
echo "DONE"

This program is supposed to backup RAWDATA and PDF files daily on Sorcerer to an external drive through a crontab. Currently the external drive is unmounted when nobody is logged in and the script must be run manually. This is not a tar archive, just a full recursive copy.

Posted by Jason Steindorf | Permalink | Categories: computers