Abstract: I need a way to monitor cifs mountpoints and I don't know how.
Hello,
I have a virtual machine with 2 CPU and 1Gb RAM running debian 5.
It mounts some of our users cifs shared folders, 200 cifs mountpoints approx.
There is an apache server running which analyses this cifs looking for specific files called cv.html and personal_info.txt. The apache has some php to make it nice. ;)
At the begging I was having some troubles and no time, so a secretary is managing a file with all the usernames and a cron reads it to mount them.
Once a day everything gets remounted, this is because of some kind of 'disconnection issue' I can not figure out how to fix it.
This is my script: (/var/www/fotos/llistat_personal.txt has a list of names)
#!/bin/sh
#############################debug
#set -x
#############################
#############################vars
UMOUNT=/bin/umount
MOUNT=/sbin/mount.cifs
CHOWN=/bin/chown
############################
############################functions
log (){
/usr/bin/logger -t `basename $0` $1;
}
desmontar () {
$UMOUNT $1
log "Umounted $1"
}
montar (){
[ -a /var/www/$1 ] && chown -R www-data.www-data /var/www/$1 || mkdir -p /var/www/$1 && chown -R www-data.www-data /var/www/$1 || echo "Error ___ $1"
$MOUNT //fbmfsu/home$/$1/web_pub/ /var/www/$1/ -o user=webpersonal1,pass=XXXXXXX,dom=FBM,uid=33,gid=33,ro,soft,nocase,noexec || echo " Error___mount__$1"
log "Mounted $1 "
}
###########################
###########################main
for i in `ls -l /var/www/personal/|grep ^d|awk '{print $8}'`
do
desmontar $i
done
for i in ` cat /var/www/fotos/llistat_personal.txt |grep -v '^#'| cut -c 1-20`
do
montar $i
done
exit 0
I know it's a bad script, but I'm here asking for help on how to improve it.
Thanks.