aboutsummaryrefslogtreecommitdiffstats
path: root/databases/courier-authlib-usergdbm/files/courier-authdaemond.sh
blob: ef48f1629b242b48345b0c298bef862e9ba5371f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
#
# An rc.subr-style startup script for courier-authdaemond service.

# PROVIDE: courier_authdaemond
# REQUIRE: LOGIN
# KEYWORD: FreeBSD shutdown

# Define these courier_authdaemond_* variables in one of these files:
#   /etc/rc.conf
#   /etc/rc.conf.local
#   /etc/rc.conf.d/courier_authdaemond
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE

courier_authdaemond_enable=${courier_authdaemond_enable-"NO"}

. %%RC_SUBR%%

name="courier_authdaemond"
rcvar=`set_rcvar`
command="%%PREFIX%%/sbin/authdaemond"

start_cmd="authdaemond_cmd start"
stop_cmd="authdaemond_cmd stop"
restart_cmd="authdaemond_cmd stop && authdaemond_cmd start"
pidfile="%%PREFIX%%/var/spool/authdaemon/pid"
procname="%%PREFIX%%/sbin/courierlogger"

load_rc_config $name

authdaemond_cmd () {
    case $1 in
    start)
        echo "Starting ${name}."
        ${command} start
        ;;
    stop)
        echo "Stopping ${name}."
        ${command} stop
        if [ $? -eq 0 ] ; then
            [ -f "$pidfile" ] && rm -f "$pidfile"
            [ -f "$pidfile".lock ] && rm -f "$pidfile".lock
            [ -S %%PREFIX%%/var/spool/authdaemon/socket ] && rm -f %%PREFIX%%/var/spool/authdaemon/socket
            return 0
        fi
        ;;
    esac
}

run_rc_command "$1"