[CentOS] Two queries: samba and usb

Mark LaPierre marklapier at aol.com
Sun Dec 1 17:05:05 UTC 2013


On 11/29/2013 01:03 AM, Rajagopal Swaminathan wrote:
> Greetings,
> 
> I have two distinct queries
> 
> 1. How to detect removal of external usb hard disk within a script and
> stop backup?
> 

You should know what the path to the external storage is when you have
it mounted.  Just check the path to see if the directory exists:

if ( -d "Path to a directory on the mounted volume" ) {
	Run Your Backup;
} else {
	Take Some Other Action;
}

This is perl script, but the same concept will work with shell script
with slightly different syntax.


-- 
    _
   °v°
  /(_)\
   ^ ^  Mark LaPierre
Registered Linux user No #267004
https://linuxcounter.net/
****



More information about the CentOS mailing list