Files
sablink-distro/net-misc/networkmanager/files/01-netmount-up-down.rc
T
2010-03-05 16:52:26 +01:00

32 lines
751 B
Bash
Executable File

#!/bin/sh
# these are the args passed by NetworkManager
MY_DEV_NAME="$1"
MY_NM_ACTION="$2"
# restart network mounts service in any case, networking setup is changed
# FIXME, remove: just restart myself, do not restart
# services that depend on me
net_fs="afs,cifs,coda,davfs,fuse,fuse.sshfs,gfs,glusterfs,lustre,ncpfs,nfs,nfs4,ocfs2,shfs,smbfs"
if [ "${MY_NM_ACTION}" = "up" ]; then
mount -at ${net_fs} &
MY_PID=$!
# give script 20 seconds then kill
# it happens with unavailable servers
sleep 20
MY_PID_ALIVE=$(kill -0 ${MY_PID} &> /dev/null)
# kill if alive
if [ "${MY_PID_ALIVE}" = "0" ]; then
kill ${MY_PID} || kill -9 ${MY_PID}
umount -at ${net_fs} -l
fi
else # down
# Lazy umount all filesystems
umount -at ${net_fs} -l
fi