Don't rsync to disconnected external drive
I run Debian Lenny and got a backup script in /etc/cron.daily that syncronizes files to an external harddrive.
The external drive is mounted using /etc/fstab to the /mnt/exthdd directory.
If the drive is unplugged/disconnected all the files is copied/synced to the real directory that is on the system drive instead of the virtual/mounted external drive (of course).
This is the line for the external drive in the /etc/fstab for curiousity. I mount using the external drives UUID number as it can have different device letters depending on connected devices etc.
UUID=C8585D27585D1592 /mnt/exthdd ntfs-3g rw,user,noauto,umask=0,nls=utf8 0 0
Is there a way for the batch script to verify if the external drive is mounted and only rsync in that case? Or is there some other solution so all files is not copied if the drive is disconnected/unmounted?
|