File: fedmsg-hub.init

package info (click to toggle)
fedmsg 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,728 kB
  • ctags: 874
  • sloc: python: 4,026; sh: 1,030; php: 149; makefile: 30
file content (87 lines) | stat: -rw-r--r-- 1,717 bytes parent folder | download | duplicates (2)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
# fedmsg-hub - This init script runs the FedMsg Hub
#
# chkconfig: - 25 85
# description:  Enabled the fedmsg hub daemon
# processname:  fedmsg-hub
# config: /etc/fedmsg.d/*
# pidfile: /var/run/fedmsg/fedmsg-hub.pid

### BEGIN INIT INFO
# Provides: fedmsg-hub
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: start or stop the fedmsg-hub
# Description: The fedmsg hub loads and begins processing consumers and \
# producers
### END INIT INFO

# Source function library.
. /etc/init.d/functions

PROG=fedmsg-hub
USER=fedmsg
OPTIONS=--daemon
PIDFILE=/var/run/fedmsg/$PROG.pid
LOCKFILE=${PIDFILE}.lock

start() {
    echo -n "Starting the FedMsg Hub: "
    if [ -f $LOCKFILE ]; then
        echo FedMsg Hub already running
        exit 2;
    fi

    if [ ! -d /var/run/fedmsg ]; then
        mkdir /var/run/fedmsg
        chown $USER:$USER /var/run/fedmsg
    fi

    daemon --user $USER $PROG $OPTIONS
    RETVAL=$?
    echo

    if [ $RETVAL -eq 0 ]; then
        success
    else
        failure
    fi
}

stop() {
        echo -n $"Stopping the FedMsg Hub: "
        killproc -p ${PIDFILE} $PROG
        echo
        rm -f ${LOCKFILE}
        RETVAL=$?
        echo
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        if [ -f $PIDFILE ]; then
            echo $"FedMsg Hub is running."
            RETVAL=0
        else
            echo $"FedMsg Hub is not running."
            RETVAL=3
        fi
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage:  {start|stop|status|reload|restart}"
        exit 1
        ;;
esac
exit $?