summaryrefslogtreecommitdiff
blob: a3fa50eec4a4b75ce13479f0208ab19117bf8f88 (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
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

BASENAME=$(echo $SVCNAME | cut -d '-' -f 1)
SERVERNAME=$(echo $SVCNAME | cut -d '-' -f 2)

depend() {
    need net 
}

checkconfig() {
    if [ ! -r /etc/conf.d/$BASENAME ]; then
        eerror "No heat conf.d file found: /etc/conf.d/$BASENAME)"
        return 1
    else
        . /etc/conf.d/$BASENAME
    fi
}

start() {
    checkconfig || return $?
    
    ebegin "Starting ${SVCNAME}"
        if [ ! -d ${PID_PATH} ]; then
                mkdir ${PID_PATH}
        chown heat:root ${PID_PATH}
        fi

    start-stop-daemon --start \
              --quiet \
              --user heat \
              --pidfile "${PID_PATH}/${SVCNAME}.pid" \
              --make-pidfile \
              --background \
              --exec /usr/bin/heat-${SERVERNAME} --  --config-file /etc/heat/heat.conf --log-file /var/log/heat/heat-${SERVERNAME}
    
    eend $? "Failed to start ${SVCNAME}"
}

stop() {
    checkconfig || return $?
    
    ebegin "Stopping ${SVCNAME}"
    
    start-stop-daemon --stop \
              --quiet \
              --user heat \
              --pidfile "${PID_PATH}/${SVCNAME}.pid" \
              --exec /usr/bin/heat-${SERVERNAME} --  --config-file /etc/heat/heat.conf

    eend $? "Failed to stop ${SVCNAME}"
}