I'm trying to write script to back my data up. I don't know much about it, so I might take a wrong approach, but what I'm trying to do is use rsync -avh several times for each directory I want to back up. However, I set destination as hard-coded value -
~/sbackup/. Now I want my script to check before running if the folder is mounted, and if not - try mount it. Therefore, script logic would look like this:
1)See if my USB disc is mounted under
~/sbackup/. (The disc - it would be good if there was a way to prevent other USB device from mounting there).
2)If it isn't try to mount it there. If you can't, write an error message and exit.
3) If it is mounted, run rest of the script.
Now I can write error messages and such, but I'm not sure about 1st step and 1st part of 2nd step.
mount, and supply path manually, but I'm open to suggestions.
udev. If you mount it normally though, your question is even simpler. Hang on, I'll post an answer.