2 # control starting, stopping, or restarting amd.
3 # usage: ctl-amd [start|stop|status|restart|condrestart|reload]
5 # Package: am-utils-6.x
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 # before running any real programs, chdir to / to avoid possible hangs on
64 # (NFS) mounts which may be restarting.
67 # search for amd.conf file
68 CF_FILE
="@sysconfdir@/amd.conf"
69 # any local copy of the conf file overrides the "global" one
70 if [ -f /etc
/amd.conf
]
72 CF_FILE
="/etc/amd.conf"
74 if [ -f @sysconfdir@
/amd.conf
]
76 CF_FILE
="@sysconfdir@/amd.conf"
78 if [ -f /etc
/local
/amd.conf
]
80 CF_FILE
="/etc/local/amd.conf"
83 # if have the directory /tftpboot/.amd, then add a tag to include it
85 if [ -d /tftpboot
/.amd
]
92 # Start the amd automounter.
93 if [ -x @sbindir@
/amd
]
95 # do not specify full path of amd so killproc() works
96 amd
-F $CF_FILE $CF_TAG
97 test -x /var
/lock
/subsys
&& touch /var
/lock
/subsys
/amd
102 # prepend space to program name to ensure only amd process dies
103 echo "killing amd..."
106 rm -f /var
/lock
/subsys
/amd
110 # kill amd, wait for it to die, then restart
114 echo "NOT restarting amd!"
116 echo "Restarting amd..."
123 if [ -f /var
/lock
/subsys
/amd
]; then
134 # run amq -v to produce status
135 pid
=`amq -p 2>/dev/null`
138 echo "amd (pid $pid) is running..."
140 echo "amd is stopped"
144 # start_msg and stop_msg are for HPUX
146 echo "Start am-utils 6.1 automounter"
149 echo "Stop am-utils 6.1 automounter"
153 echo "Usage: $0 [start|stop|status|restart|condrestart|reload]"