2 # control starting, stopping, or restarting amd.
3 # usage: ctl-amd [start | stop | restart]
5 # Package: am-utils-6.0
6 # Author: Erez Zadok <ezk@cs.columbia.edu>
9 # description: Runs the automount daemon that mounts devices and NFS hosts \
12 # config: /etc/amd.conf
17 exec_prefix=@exec_prefix@
18 PATH=@sbindir@:@bindir@:/usr/ucb:/usr/bin:/bin:${PATH}
21 # kill the named process(es)
24 # first try to get PID via an amq RPC
25 pid=`amq -p 2>/dev/null`
34 pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
43 pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
52 pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
63 # search for amd.conf file
64 CF_FILE="${prefix}/etc/amd.conf"
65 # any local copy of the conf file overrides the "global" one
66 if [ -f /etc/amd.conf ]
68 CF_FILE="/etc/amd.conf"
70 if [ -f ${prefix}/etc/amd.conf ]
72 CF_FILE="${prefix}/etc/amd.conf"
74 if [ -f /etc/local/amd.conf ]
76 CF_FILE="/etc/local/amd.conf"
79 # if have the directory /tftpboot/.amd, then add a tag to include it
81 if [ -d /tftpboot/.amd ]
89 # Start the amd automounter.
91 if [ -x @sbindir@/amd ]
93 # do not specify full path of amd so killproc() works
94 amd -F $CF_FILE $CF_TAG
99 # prepend space to program name to ensure only amd process dies
100 echo "killing amd..."
106 # kill amd, wait for it to die, then restart
110 echo "NOT restarting amd!"
112 echo "Restarting amd..."
119 echo "Usage: @sbindir@/ctl-amd [ start | stop | restart ]"