Roger Searle wrote, On 09/13/2013 12:03 PM:
I learnt from someone here, think it was Jim from memory, that I can
do something like this in my script:
# don't proceed if usb drive not mounted as/where expected:
if [ -e /media/truecrypt1/STOP ]
then
...
which of course assumes you know the drive will be mounted in
/media/truecrypt1 and that you have previously created the file named
STOP when it is not mounted.
On 13/09/13 11:55, Robert Fisher wrote:
Do not run rsync to backup files to a portable drive without first
checking that the drive is mounted.
Filling up the root partition is not easy to fix.
I know this from recent experience.
I've got a similar dodge, using mountpoint permissions, spefically the
immutable bit on the directory when nothing is mounted.
# ls -lad backup/
drwx------ 2 root root 4096 Sep 13 05:13 backup/
# lsattr /
----i-------------- /backup
# touch /backup/testfile
touch: cannot touch `/backup/testfile': Permission denied
# mount /dev/sdc1 /backup/
# touch /backup/testfile
# ls -lad /backup/
drwxr-xr-x 4 root root 45056 Sep 13 05:15 /backup/
# ls -la /backup/
total 60
drwxr-xr-x 4 root root 45056 Sep 13 05:15 .
drwxr-xr-x 22 root root 4096 Sep 13 05:13 ..
-rwxr-xr-x 1 root root 0 Sep 13 05:15 testfile
So the system can't write to the directory unless something is mounted
there.
Another option is to use automount to mount stuff in the right place on
demand.
Does bottom posting in reply to a top post make it better or worse?
--
CF
_______________________________________________
Linux-users mailing list
[email protected]
http://lists.canterbury.ac.nz/mailman/listinfo/linux-users