Mercurial > kallithea
comparison hg_app_daemon @ 426:17d5028e055c
updated init scripts to start-stop-daemons
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 26 Aug 2010 17:28:11 +0200 |
parents | |
children | 41504f4aa96b |
comparison
equal
deleted
inserted
replaced
424:55ada111bca6 | 426:17d5028e055c |
---|---|
1 #!/sbin/runscript | |
2 ######################################## | |
3 #### THIS IS AN GENTOO INIT.D SCRIPT#### | |
4 ######################################## | |
5 | |
6 APP_NAME="hg_app" | |
7 APP_HOMEDIR="marcink/python_workspace" | |
8 APP_PATH="/home/$APP_HOMEDIR/$APP_NAME" | |
9 | |
10 CONF_NAME="production.ini" | |
11 | |
12 PID_PATH="$APP_PATH/$APP_NAME.pid" | |
13 LOG_PATH="$APP_PATH/$APP_NAME.log" | |
14 | |
15 PYTHON_PATH="/home/$APP_HOMEDIR/v-env" | |
16 | |
17 RUN_AS="marcink" | |
18 | |
19 DAEMON="$PYTHON_PATH/bin/paster" | |
20 | |
21 DAEMON_OPTS="serve --daemon \ | |
22 --user=$RUN_AS \ | |
23 --group=$RUN_AS \ | |
24 --pid-file=$PID_PATH \ | |
25 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" | |
26 | |
27 #extra options | |
28 opts="${opts} restartdelay" | |
29 | |
30 depend() { | |
31 need nginx | |
32 } | |
33 | |
34 start() { | |
35 ebegin "Starting $APP_NAME" | |
36 cd $APP_PATH | |
37 start-stop-daemon --start --quiet\ | |
38 --pidfile $PID_PATH \ | |
39 --user $RUN_AS \ | |
40 --exec $DAEMON -- $DAEMON_OPTS | |
41 eend $? | |
42 } | |
43 | |
44 stop() { | |
45 ebegin "Stopping $APP_NAME" | |
46 start-stop-daemon --stop --quiet \ | |
47 --pidfile $PID_PATH || echo "$APP_NAME - Not running!" | |
48 if [ -f $PID_PATH ]; then | |
49 rm $PID_PATH | |
50 fi | |
51 eend $? | |
52 } | |
53 | |
54 restartdelay() { | |
55 #stop() | |
56 echo "sleep3" | |
57 sleep 3 | |
58 | |
59 #start() | |
60 } |