Merge branch 'debian'
[hcoop/debian/courier-authlib.git] / debian / courier-authdaemon.init
CommitLineData
426e7833 1#! /bin/sh -e
0fde1ce3 2#
3### BEGIN INIT INFO
4# Provides: courier-authdaemon
5# Required-Start: $remote_fs $syslog
6# Required-Stop: $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9### END INIT INFO
426e7833 10
11prefix="/usr"
12exec_prefix=${prefix}
13sysconfdir="/etc/courier"
14sbindir="${exec_prefix}/sbin"
15daemonscript="${sbindir}/authdaemond"
940be80e
SHR
16rundir_courier="/var/run/courier"
17rundir="/var/run/courier/authdaemon"
18pidfile="${rundir}/pid"
426e7833 19
20. /lib/lsb/init-functions
21
22# Check for a leftover init script
23if [ ! -x $daemonscript ]; then
24 exit 0
25fi
26
27case "$1" in
28start)
29 # Start daemon.
30 cd /
31 log_daemon_msg "Starting Courier authentication services" "authdaemond"
940be80e
SHR
32 if [ ! -d "$rundir_courier" ]; then
33 mkdir -m 0775 $rundir_courier
34 chown daemon:daemon $rundir_courier
35 # set file context for SELinux (#668564)
36 [ -x /sbin/restorecon ] && /sbin/restorecon $rundir_courier
37 fi
38 if [ ! -d "$rundir" ]; then
39 mkdir -m 0750 $rundir
40 chown daemon:daemon $rundir
41 # set file context for SELinux (#668564)
42 [ -x /sbin/restorecon ] && /sbin/restorecon $rundir
43 fi
426e7833 44 $daemonscript start
45 log_end_msg 0
46 ;;
47stop)
48 # Stop daemon.
49 cd /
50 log_daemon_msg "Stopping Courier authentication services" "authdaemond"
51 $daemonscript stop
52 log_end_msg 0
53 ;;
940be80e 54restart|force-reload)
426e7833 55 $0 stop
56 $0 start
57 ;;
940be80e
SHR
58status)
59 status_of_proc -p "$pidfile" "" "authdaemond" && exit 0 || exit $?
60 ;;
426e7833 61*)
940be80e 62 echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
426e7833 63 exit 2
64 ;;
65esac
66exit 0