Hi guys,
This is just a follow-up so others can use this really simple shell
script to backup their machines on a network using tar over ssh.
I took the advice of Angus, Jan and Steve who suggested
that I use a test in the .bashrc for interactive invocation of the
shell by checking the value of $PS1.
Interesting was the discussion of whether to use just [ "$PS1" ] or
explicitely checking if it's not null ie [ -n "$PS1" ] or not zero
length ie [ ! -z "$PS1" ]. Hey I like the first one :-)
In any case I have also made sure now that my root shell echo's nothing
anyway. Better safe than having crap at the start of a tar your trying
to restore from in the future.
----------------------------------------------------------
#!/bin/bash
# List of the directories to backup on Martel
list="admin caves mikel kinetics projects"
echo
echo 'Tape Status'
echo '-----------'
# TODO later check for status and exit if there are probs.
mt -f /dev/rmt0 status
echo
echo
echo 'Backing up'
echo '---------'
for i in $list; do
echo " Backing up martel: /home/$i"
ssh root@martel 'tar cf - /home/$i' | dd > /dev/nst0
done
echo
mt -f /dev/rmt0 offline
----------------------------------------------------------
Thanks for all the help :-)
Mike
--
Learned men are the cisterns of knowledge, not the fountainheads.
--------------------------------------------------------------------
Michael Lake
Active caver, Linux enthusiast and interested in anything technical.
Safety Convenor, Australian Speleological Federation
Owner, Speleonics (Australia)
--------------------------------------------------------------------
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug