File: init-d-script-courier

package info (click to toggle)
courier 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,444 kB
  • sloc: ansic: 130,619; cpp: 33,255; sh: 10,437; perl: 4,250; makefile: 3,447; sed: 39
file content (60 lines) | stat: -rwxr-xr-x 1,366 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

do_tmpfiles() {
    local type path mode user group

    TMPFILES=/usr/lib/tmpfiles.d/$1.conf

    if [ -r "$TMPFILES" ]; then
	while read type path mode user group age argument; do
            if [ "$type" = "d" ]; then
                mkdir -p "$path"
		chmod "$mode" "$path"
                chown "$user:$group" "$path"
            fi
        done < $TMPFILES
    fi
}

do_start_prepare() {
    do_tmpfiles $(basename $0)
}

do_start_cmd_override() {
    if [ "$DO_START" != "yes" ]; then
	# If the service is disabled, the start script still needs to signal
	# successful, otherwise postinst scripts barf.  This behavior matches
	# that passing the --oknodo flag to start-stop-daemon.
	return 0
    fi

    if pidofproc ${PIDFILE:+-p ${PIDFILE}} "$DAEMON" >/dev/null; then
	# Similar for process already running: a subsequent call to start the
	# service must not return an error.
	return 0
    fi

    if $DAEMON start $DAEMON_ARGS; then
	return 0
    else
	return 2
    fi
}

do_stop_cmd_override() {
    if ! pidofproc ${PIDFILE:+-p ${PIDFILE}} "$DAEMON" >/dev/null; then
	# If the service is not currently running, a call to stop it should
	# indicate success.
	return 0
    fi

    if $DAEMON stop $DAEMON_ARGS; then
	return 0;
    else
	return 2;
    fi
}

do_status_override() {
    status_of_proc ${PIDFILE:+-p ${PIDFILE}} "$DAEMON" "$NAME"
}