Link to home
Start Free TrialLog in
Avatar of M DXYZ
M DXYZFlag for United States of America

asked on

bash samba connection check/mount

Hi I need help creating a script which main purpose would be to check if the smbmount connection has been established. If is has not, then ask the user to enter the ip address of the node that will be tested. And the last portion would be to issue to smbmount command:

smbmount //10.5.0.3/icsglobal /mnt/iotest/ --verbose -o username=admin pass=admin1
#Prompt for remote or local test, if is remote invoke samba, for local do nothing
#Samba check and mount
#Checking if mount /mnt/iotest directory exists
 
samba=/mnt/mountpoint
 
read -p "Please enter the ip address of the node to test: " -e ip
 
 
df -h |grep $samba
if [ -d $samba];then
   echo "Directory $samba appears to be mounted"
else
   if [ ! -d $samba];then
   echo "Creating $samba directory"
   echo "Mounting $samba directory for samba connection"
   smbmount //10.5.0.3/mnt/iotest/ --verbose -o username=admin pass=admin1
fi

Open in new window

SOLUTION
Avatar of Maciej S
Maciej S
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial