I have a script running in a cron job that mounts a usb memory.
deletes all files found on the usb stick.
copies a new directory to the usb.
and prints out a log file of what the job did. All works well.
in RHEL unlike fedora usb sticks do not auto mount
I need to know is there something I can put in an if statement that says if you don't find a usb stick then print an error message and exit.
I tried
if [mount /dev/sdb1 /media/usb]
then
else
fi
but mount does not return a value so answer is always false even if the usb is there.
any suggestion on how to check if the someone actually remembered to insert the usb stick?
gary
Start Free Trial