drm/i915: Fix hangs on some broadwell machines
[dragonfly.git] / contrib / amd / scripts / ctl-hlfsd.in
CommitLineData
984263bc
MD
1#!/bin/sh
2# control starting, stopping, or restarting hlfsd.
3# usage: ctl-hlfsd [start | stop | restart]
4#
5# Package: am-utils-6.0
6# Author: Erez Zadok <ezk@cs.columbia.edu>
7#
8# chkconfig: - 72 28
9# description: hlfsd is a daemon similar to amd, used to redirect user
10# mail to home directory of the user
11# processname: hlfsd
12#
13
14# set path
15prefix=@prefix@
16exec_prefix=@exec_prefix@
17PATH=@sbindir@:@bindir@:/usr/ucb:/usr/bin:/bin:${PATH}
18export PATH
19
20# kill the named process(es)
21killproc()
22{
23# try bsd style ps
24pscmd="ps axc"
25pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
26if test "$pid" != ""
27then
28 kill $pid
29 return 0
30fi
31
32# try bsd44 style ps
33pscmd="ps -x"
34pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
35if test "$pid" != ""
36then
37 kill $pid
38 return 0
39fi
40
41# try svr4 style ps
42pscmd="ps -e"
43pid=`${pscmd} 2>/dev/null | grep "$1" | sed -e 's/^ *//' -e 's/ .*//'`
44if test "$pid" != ""
45then
46 kill $pid
47 return 0
48fi
49
50# failed
51return 1
52}
53
54# locate logs directory
55if [ -d /var/log ]; then
56 logdir="/var/log"
57else
58 logdir="/tmp"
59fi
60
61# locate the mail spool directory
62if [ -d /var/mail/. ]; then
63 maildir="/var/mail"
64 altmaildir="/var/alt_mail"
65else
66 maildir="/usr/spool/mail"
67 altmaildir="/usr/spool/alt_mail"
68fi
69
70# locate any optional password file
71if [ -f ${prefix}/etc/passwd ]; then
72 PASSWD_FILE="-P ${prefix}/etc/passwd"
73else
74 PASSWD_FILE=""
75fi
76
77case "$1" in
78'start')
79 #
80 # Start the hlfsd mail redirector service
81 #
82 if [ -x @sbindir@/hlfsd -a -h $maildir ]
83 then
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 &
86 fi
87 ;;
88
89'stop')
90 # prepend space to program name to ensure only amd process dies
91 killproc " hlfsd"
92 ;;
93
94'restart')
95 # kill hlfsd, wait for it to die, then restart
96 echo "killing hlfsd..."
97 ctl-hlfsd stop
98 echo "Waiting for 10 seconds..."
99 sleep 10 # hope that would be enough
100 echo "Restarting hlfsd..."
101 ctl-hlfsd start
102 ;;
103
104*)
105 echo "Usage: @sbindir@/ctl-hlfsd [ start | stop | restart ]"
106 ;;
107esac