##// END OF EJS Templates
little improvements for debian init.d script
marcink -
r3225:f9540f9c beta
parent child Browse files
Show More
@@ -2,7 +2,7 b''
2 ########################################
2 ########################################
3 #### THIS IS A DEBIAN INIT.D SCRIPT ####
3 #### THIS IS A DEBIAN INIT.D SCRIPT ####
4 ########################################
4 ########################################
5
5
6 ### BEGIN INIT INFO
6 ### BEGIN INIT INFO
7 # Provides: rhodecode
7 # Provides: rhodecode
8 # Required-Start: $all
8 # Required-Start: $all
@@ -12,29 +12,29 b''
12 # Short-Description: starts instance of rhodecode
12 # Short-Description: starts instance of rhodecode
13 # Description: starts instance of rhodecode using start-stop-daemon
13 # Description: starts instance of rhodecode using start-stop-daemon
14 ### END INIT INFO
14 ### END INIT INFO
15
15
16 APP_NAME="rhodecode"
16 APP_NAME="rhodecode"
17 APP_HOMEDIR="marcink/python_workspace"
17 APP_HOMEDIR="opt"
18 APP_PATH="/home/$APP_HOMEDIR/$APP_NAME"
18 APP_PATH="/$APP_HOMEDIR/$APP_NAME"
19
19
20 CONF_NAME="production.ini"
20 CONF_NAME="production.ini"
21
21
22 PID_PATH="$APP_PATH/$APP_NAME.pid"
22 PID_PATH="$APP_PATH/$APP_NAME.pid"
23 LOG_PATH="$APP_PATH/$APP_NAME.log"
23 LOG_PATH="$APP_PATH/$APP_NAME.log"
24
24
25 PYTHON_PATH="/home/$APP_HOMEDIR/v-env"
25 PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv"
26
26
27 RUN_AS="marcink"
27 RUN_AS="root"
28
28
29 DAEMON="$PYTHON_PATH/bin/paster"
29 DAEMON="$PYTHON_PATH/bin/paster"
30
30
31 DAEMON_OPTS="serve --daemon \
31 DAEMON_OPTS="serve --daemon \
32 --user=$RUN_AS \
32 --user=$RUN_AS \
33 --group=$RUN_AS \
33 --group=$RUN_AS \
34 --pid-file=$PID_PATH \
34 --pid-file=$PID_PATH \
35 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
35 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
36
36
37
37
38 start() {
38 start() {
39 echo "Starting $APP_NAME"
39 echo "Starting $APP_NAME"
40 PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
40 PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
@@ -43,19 +43,33 b' start() {'
43 --user $RUN_AS \
43 --user $RUN_AS \
44 --exec $DAEMON -- $DAEMON_OPTS
44 --exec $DAEMON -- $DAEMON_OPTS
45 }
45 }
46
46
47 stop() {
47 stop() {
48 echo "Stopping $APP_NAME"
48 echo "Stopping $APP_NAME"
49 start-stop-daemon -d $APP_PATH \
49 start-stop-daemon -d $APP_PATH \
50 --stop --quiet \
50 --stop --quiet \
51 --pidfile $PID_PATH || echo "$APP_NAME - Not running!"
51 --pidfile $PID_PATH || echo "$APP_NAME - Not running!"
52
52
53 if [ -f $PID_PATH ]; then
53 if [ -f $PID_PATH ]; then
54 rm $PID_PATH
54 rm $PID_PATH
55 fi
55 fi
56 }
56 }
57
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
58 case "$1" in
69 case "$1" in
70 status)
71 status
72 ;;
59 start)
73 start)
60 start
74 start
61 ;;
75 ;;
@@ -73,4 +87,4 b' case "$1" in'
73 *)
87 *)
74 echo "Usage: $0 {start|stop|restart}"
88 echo "Usage: $0 {start|stop|restart}"
75 exit 1
89 exit 1
76 esac
90 esac No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now