nIK write this script for me...!
Code:
#! /bin/sh
# these must be tuned.......
IP=192.168.0.6
SERVER=nik_new # it don't work with IP, so i had to add host name in /ets/hosts to let it work
WORK_GROUP=gladiators
SHARE1=i
SHARE2=h
MOUNT_POINT1=/root/testi
MOUNT_POINT2=/root/testh
####################
# testing net part #
####################
case "$1" in
start)
COMMAND=START
case `ping -q -n -c 3 -w 5 $IP` in
*'0 received'*)
COMMAND=STOP
echo 'server is down, no way to start :('
;;
*)
;;
esac
;;
stop)
COMMAND=STOP
;;
*)
case `ping -q -n -c 3 -w 5 $IP` in
*'0 received'*)
COMMAND=STOP
echo 'server is down'
;;
*)
COMMAND=START
echo 'turning on'
;;
esac
;;
esac
###########################################################
# start/stop part - depend of parameter and server status #
###########################################################
case "$COMMAND" in
STOP)
case `mount | grep smb | wc -l` in
*'0')
# do nothing - nothing was mounted
;;
*)
umount $MOUNT_POINT1
umount $MOUNT_POINT2
# same for all other mount points
;;
esac
;;
START)
case `mount | grep smb | wc -l` in
*'0')
mount -t smbfs //$SERVER/$SHARE1 $MOUNT_POINT1 -o ro,guest,workgroup=$WORK_GROUP
mount -t smbfs //$SERVER/$SHARE2 $MOUNT_POINT2 -o ro,guest,workgroup=$WORK_GROUP
# same for all other mount points
;;
*)
# do nothing - it was already done
;;
esac
;;
esac
But when I put it in my rc.local fail to start it...it just do not start it give me an error that it could be run at this stage of the boot?Something might be missing at this stage?