comparison init.d/kallithea-daemon-debian @ 4190:99ad9d0af1a3 kallithea-2.2.5-rebrand

Rename init scripts and fix references inside them
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:04:40 -0400
parents init.d/rhodecode-daemon2@f9540f9c5999
children e285bb7abb28
comparison
equal deleted inserted replaced
4189:9793473d74be 4190:99ad9d0af1a3
1 #!/bin/sh -e
2 ########################################
3 #### THIS IS A DEBIAN INIT.D SCRIPT ####
4 ########################################
5
6 ### BEGIN INIT INFO
7 # Provides: kallithea
8 # Required-Start: $all
9 # Required-Stop: $all
10 # Default-Start: 2 3 4 5
11 # Default-Stop: 0 1 6
12 # Short-Description: starts instance of kallithea
13 # Description: starts instance of kallithea using start-stop-daemon
14 ### END INIT INFO
15
16 APP_NAME="kallithea"
17 APP_HOMEDIR="opt"
18 APP_PATH="/$APP_HOMEDIR/$APP_NAME"
19
20 CONF_NAME="production.ini"
21
22 PID_PATH="$APP_PATH/$APP_NAME.pid"
23 LOG_PATH="$APP_PATH/$APP_NAME.log"
24
25 PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv"
26
27 RUN_AS="root"
28
29 DAEMON="$PYTHON_PATH/bin/paster"
30
31 DAEMON_OPTS="serve --daemon \
32 --user=$RUN_AS \
33 --group=$RUN_AS \
34 --pid-file=$PID_PATH \
35 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
36
37
38 start() {
39 echo "Starting $APP_NAME"
40 PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
41 --start --quiet \
42 --pidfile $PID_PATH \
43 --user $RUN_AS \
44 --exec $DAEMON -- $DAEMON_OPTS
45 }
46
47 stop() {
48 echo "Stopping $APP_NAME"
49 start-stop-daemon -d $APP_PATH \
50 --stop --quiet \
51 --pidfile $PID_PATH || echo "$APP_NAME - Not running!"
52
53 if [ -f $PID_PATH ]; then
54 rm $PID_PATH
55 fi
56 }
57
58 status() {
59 echo -n "Checking status of $APP_NAME ... "
60 pid=`cat $PID_PATH`
61 status=`ps ax | grep $pid | grep -ve grep`
62 if [ "$?" -eq 0 ]; then
63 echo "running"
64 else
65 echo "NOT running"
66 fi
67 }
68
69 case "$1" in
70 status)
71 status
72 ;;
73 start)
74 start
75 ;;
76 stop)
77 stop
78 ;;
79 restart)
80 echo "Restarting $APP_NAME"
81 ### stop ###
82 stop
83 wait
84 ### start ###
85 start
86 ;;
87 *)
88 echo "Usage: $0 {start|stop|restart}"
89 exit 1
90 esac