Hi,
I'm trying to script a very basic shell script that tars a directory, does a mount of a network share on my Windows box and then copies across the tar archive. It all works fine when I'm not using the if statement, but I want to use the if statement to check if the mount of the network share has been successful, so it doesn't attempt to copy the file if it hasn't mounted the share. How can I do this?
Here's my script at the moment...
Code:
#!/bin/sh
# Change to snapshots directory
cd /.snapshots/
# Tar & GZip the most recent backup
tar -czvf shimmy.backup.tar.gz hourly.0/
# Move the backup archive to SIMON
if [ `mount -t smbfs -o rw,guest "//SIMON/Archives & Backups" "/mnt/backup/"` ]; then
mv /.snapshots/shimmy.backup.tar.gz /mnt/backup/SHIMMY/
umount /mnt/backup/
echo "Successfully copied backup archive"
else
echo "Error copying backup archive"
fi
TIA for your help!
Simon Plenderleith