summaryrefslogtreecommitdiffstats
path: root/gogs_supervisord.sh
blob: 43908094b5800153f112987dab8a58738c7fe17e (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
#!/bin/sh

echo 'plase remember to modify the command path in etc/conf/supervisord.conf(line 23)'

PID="/tmp/supervisord.pid"
CONF="conf/etc/supervisord.conf"

LOGDIR="log"  
if [ ! -d $LOGDIR ]; then  
    mkdir $LOGDIR
fi

stop() {
    if [ -f $PID ]; then
        kill `cat -- $PID`
        rm -f -- $PID
        echo "stopped"
    fi
}

start() {
    echo "starting"
    if [ ! -f $PID ]; then
        supervisord -c $CONF
        echo "started"
    fi
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
esac