2 # control starting, stopping, or restarting amd.
3 # usage: ctl-amd [start|stop|status|restart|condrestart|reload]
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 ]
88 # Start the amd automounter.
89 if [ -x @sbindir@/amd ]
91 # do not specify full path of amd so killproc() works
92 amd -F $CF_FILE $CF_TAG
97 # prepend space to program name to ensure only amd process dies
104 # kill amd, wait for it to die, then restart
108 echo "NOT restarting amd!"
110 echo "Restarting amd..."
117 if [ -f /var/lock/subsys/amd ]; then
128 # run amq -v to produce status
129 pid=`amq -p 2>/dev/null`
132 echo "amd (pid $pid) is running..."
134 echo "amd is stopped"
138 # start_msg and stop_msg are for HPUX
140 echo "Start am-utils 6.0 automounter"
143 echo "Stop am-utils 6.0 automounter"
147 echo "Usage: @sbindir@/ctl-amd [start|stop|status|restart|condrestart|reload]"