2 # control starting, stopping, or restarting hlfsd.
3 # usage: ctl-hlfsd [start | stop | restart]
5 # Package: am-utils-6.0
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 # locate logs directory
55 if [ -d /var/log ]; then
61 # locate the mail spool directory
62 if [ -d /var/mail/. ]; then
64 altmaildir="/var/alt_mail"
66 maildir="/usr/spool/mail"
67 altmaildir="/usr/spool/alt_mail"
70 # locate any optional password file
71 if [ -f ${prefix}/etc/passwd ]; then
72 PASSWD_FILE="-P ${prefix}/etc/passwd"
80 # Start the hlfsd mail redirector service
82 if [ -x @sbindir@/hlfsd -a -h $maildir ]
84 echo @sbindir@/hlfsd ${PASSWD_FILE} -a $altmaildir -x all -D fork -l $logdir/hlfsd /mail/home .mailspool
85 @sbindir@/hlfsd ${PASSWD_FILE} -a $altmaildir -x all -D fork -l $logdir/hlfsd /mail/home .mailspool &
90 # prepend space to program name to ensure only amd process dies
95 # kill hlfsd, wait for it to die, then restart
96 echo "killing hlfsd..."
98 echo "Waiting for 10 seconds..."
99 sleep 10 # hope that would be enough
100 echo "Restarting hlfsd..."
105 echo "Usage: @sbindir@/ctl-hlfsd [ start | stop | restart ]"