[WBEL-users] Writing a script in bash
Jean Lee
jean.lee at free.fr
Tue May 24 10:16:14 CDT 2005
Hello,
I am not sure this is the correct list to ask this question but I don't
know where to ask it. If somebody knows, please redirect me.
I am writing a backup script using bash and I want to log the output in
"/var/log/backup.log"
The saved files have to be stored on an external hard drive on "/dev/sda1"
the script works and contains :
mount /dev/sda1
....
cp /usr/Users/FolderToBackup /mnt/usb0/
....
umount /dev/sda1
On the terminal command line, I type :
./backup >> /var/log/backup.log
nothing is returned on the terminal and all the output is redirected to
"/var/log/backup.log".
It works always fine.
Now, if the external hard drive is not present on "/dev/sda1" and I type :
./backup >> /var/log/backup.log
On the terminal, I have :
/dev/sda1 : Input/Output error
mount : you must specify the filesystem type
umount : /dev/sda1 not mounted
My questions are :
Why are these lines not logged in "/var/log/backup.log" ?
Is there a way to redirect it ?
Or perhaps that I made a mistake in my script architecture (This is my
first script) :
I want to test an external hard drive availability on "/dev/sda1" by
doing a grep in "/var/log/backup.log". Does anybody knows a better way
to do it ? (better than logging the output of "mount" in
"/var/log/backup.log" and then testing it with a grep)
Thank you for any answer,
Jean LEE
More information about the Whitebox-users
mailing list