Greetings,
I have a nightly scheduled script which creates a $vhostname directory under /mnt, mounts a windows box pointing to /mnt/$vhostname then rsyncs (pulls) some files/folders from the mount point.
After this, I want to unmount the drive and remove the /mnt/$vhostname directory.
Problem is that removing the /mnt/$vhostname directory sometimes ends up deleting all the files on the source!
Example of script (stripped out lots of superfluous stuff):
Code:
vHOSTNAME='testhost'
vRSYNCFLAGS='-ahvz --inplace'
/bin/mkdir -p /mnt/${vHOSTNAME}
/usr/bin/rsync ${vRSYNCFLAGS} /mnt/${vHOSTNAME}/KAVSHARE /backups3/${vHOSTNAME}/
/bin/umount -l /mnt/${vHOSTNAME}
/bin/rm -Rf /mnt/${vHOSTNAME}
It seems that my umount line isn't disconnecting the mount, leaving the following line to literally delete all directories, recursively.
Is there a way of safely just deleting the directory (ie: mount link) without linux accidentally trashing the whole source?
Thanks in advance.