CIFS file system check.
I have written a script to take backup of linux data on window's shared folder.
I have used following method in my script. Code:
mount -t cifs <windowshare> -o username=username,password=myPassword <mountlocation> How would i check if CIFS filesystem or service is present or not before executing the script? |
Hmm ;) your subject was a little misleading to me, I really thought you wanted to fsck a remote fs.
Well I think cifs is available on MOST linux systems, but it is often there as a module. You could check by the following procedure: Code:
HAVE_CIFS=no |
Quote:
Code:
# echo $HAVE_CIFS |
This is why HAVE_CIFS is set to "no" in the first line!
PS: Maybe read up a little on shell scripting: The command after && is ONLY executed when the command preceding it returned successful. The script WILL work like presented in my first post. |
Quote:
what is the difference between Code:
"x$HAVE_CIFS" = "xyes" Code:
"$HAVE_CIFS" = "yes" |
The first won't break with versions of "test" that don't deal with emtpy strings correctly. Although $HAVE_CIFS can't be empty in THIS script, I just ALWAYS use the "safe" version.
|
Quote:
|
All times are GMT -5. The time now is 04:21 PM. |