#!/bin/ksh
# script to tar /etc up and save it to USB-stick
# old settings file will be overwritten

#try to mount USB stick
mount /dev/sd0i /mnt

if [ $? = 0 ]; then
    #device sucessfully mounted
    tar -zcf /mnt/settings.tgz /etc
    if [ $? = 0 ]; then
       	echo 'Backup done.' 
    else
        echo 'Error occured!'
    fi
    umount /mnt
else
    echo 'Error mounting USB device'
fi

