#!/bin/bash autofs_start() { for mountspec in $(/bin/ls /etc/auto_mount/*.auto) do source $mountspec MOUNT_BASE=${mountspec%.auto} echo -e "\nStarting automount for group ${MOUNT_BASE##*/} ..." /usr/sbin/automount --timeout=${TIMEOUT} $MOUNTPOINT file \ $MOUNT_BASE.map done } autofs_stop() { echo -en "Stopping automount ..." /bin/killall -USR1 automount /bin/killall automount } autofs_restart() { $0 stop sleep 1 $0 start } case "$1" in 'start') autofs_start ;; 'stop') autofs_stop ;; 'restart') autofs_restart ;; *) echo "Usage: $0 " esac