summaryrefslogtreecommitdiff
blob: fdd809c5485cb8a2768b22e7bcbf23ef453f07bc (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/sbin/openrc-run
#
# chkconfig: - 91 35
# description: Starts and stops dbmail-timsieved
#


PROGRAM=dbmail-timsieved

BIN_DIR=/usr/sbin
PID_DIR=/var/run/dbmail
PID=pid

# Where is the dbmail.conf file located?
CONFIG=/etc/dbmail/dbmail.conf

## not in 3.1.x yet
#extra_started_commands="reload"

depend() {
        need net
        # This won't cause a hard failure if neither is installed, however.
        use mysql
        use pgsql
        after mta
}

initService() {
    # Avoid using root's TMPDIR
    unset TMPDIR
    
    # Check that config file exists.
    if [ ! -e $CONFIG ]; then
        eerror "Config file not found ($CONFIG)"
        eerror "An example config can be found in /etc/dbmail/dbmail.conf.dist"
        return 1
    fi

    checkpath -d $PID_DIR -m 750 -o dbmail:dbmail

    RETVAL=0
}

start() {
	initService
        ebegin "Starting DBMail SIEVE daemon ($PROGRAM)"
            start-stop-daemon --start --quiet \
                --pidfile $PID_DIR/$PROGRAM.$PID \
                --exec $BIN_DIR/$PROGRAM \
                --name $PROGRAM \
                -- -f $CONFIG -p $PID_DIR/$PROGRAM.$PID 2>&1
        eend $?
}

stop() {
        ebegin "Stopping DBMail SIEVE daemon ($PROGRAM)"
            start-stop-daemon --stop --quiet --retry 15 \
                --pidfile $PID_DIR/$PROGRAM.$PID
        eend $?
}

## not in 3.1.x yet
#reload() {#
#       ebegin "Reloading DBMail SIEVE daemon ($PROGRAM)"
#           start-stop-daemon --quiet --signal HUP \
#               --pidfile $PID_DIR/$PROGRAM.$PID
#       eend $?
#}