2 # control starting, stopping, or restarting hlfsd.
3 # usage: ctl-hlfsd [start | stop | restart]
5 # Package: am-utils-6.x
6 # Author: Erez Zadok <ezk@cs.columbia.edu>
9 # description: hlfsd is a daemon similar to amd, used to redirect user
10 # mail to home directory of the user
16 exec_prefix
=@exec_prefix@
17 PATH
=@sbindir@
:@bindir@
:/usr
/ucb
:/usr
/bin
:/bin
:${PATH}
20 # kill the named process(es)
25 pid
=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
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/ .*//'`
54 # before running any real programs, chdir to / to avoid possible hangs on (NFS)
58 # locate logs directory
59 if [ -d /var
/log
]; then
65 # locate the mail spool directory
66 if [ -d /var
/mail
/.
]; then
68 altmaildir
="/var/alt_mail"
69 elif [ -d /var
/spool
/mail
/.
]; then
70 maildir
="/var/spool/mail"
71 altmaildir
="/var/spool/alt_mail"
73 maildir
="/usr/spool/mail"
74 altmaildir
="/usr/spool/alt_mail"
77 # locate any optional password file
78 if [ -f @sysconfdir@
/passwd
]; then
79 PASSWD_FILE
="-P @sysconfdir@/passwd"
87 # Start the hlfsd mail redirector service
89 if [ -x @sbindir@
/hlfsd
-a -h $maildir ]
91 echo @sbindir@
/hlfsd
${PASSWD_FILE} -a $altmaildir -x all
-l $logdir/hlfsd
/mail
/home .mailspool
92 @sbindir@
/hlfsd
${PASSWD_FILE} -a $altmaildir -x all
-l $logdir/hlfsd
/mail
/home .mailspool
&
93 test -x /var
/lock
/subsys
&& touch /var
/lock
/subsys
/hlfsd
98 # prepend space to program name to ensure only amd process dies
100 test -f /var
/lock
/subsys
/hlfsd
&& rm -f /var
/lock
/subsys
/hlfsd
104 # kill hlfsd, wait for it to die, then restart
105 echo "killing hlfsd..."
107 echo "Waiting for 10 seconds..."
108 sleep 10 # hope that would be enough
109 echo "Restarting hlfsd..."
114 echo "Usage: @sbindir@/ctl-hlfsd [ start | stop | restart ]"