#!/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 if [ "${MY_NM_ACTION}" = "up" ]; then mount -at afs,cifs,coda,davfs,fuse,fuse.sshfs,gfs,glusterfs,lustre,ncpfs,nfs,nfs4,ocfs2,shfs,smbfs & 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} fi fi