annotate init.d/rhodecode-daemon2 @ 3181:efe23d6c178c rhodecode-0.0.1.5.2

merged with beta
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 21 Jan 2013 00:49:59 +0100
parents 238bea955b54
children f9540f9c5999
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
1 #!/bin/sh -e
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
2 ########################################
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
3 #### THIS IS A DEBIAN INIT.D SCRIPT ####
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
4 ########################################
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
5
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
6 ### BEGIN INIT INFO
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
7 # Provides: rhodecode
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
8 # Required-Start: $all
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
9 # Required-Stop: $all
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
10 # Default-Start: 2 3 4 5
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
11 # Default-Stop: 0 1 6
549
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
12 # Short-Description: starts instance of rhodecode
f99075170eb4 more renames for rhode code !!
Marcin Kuzminski <marcin@python-works.com>
parents: 548
diff changeset
13 # Description: starts instance of rhodecode using start-stop-daemon
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
14 ### END INIT INFO
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
15
548
b75b77ef649d renamed hg_app to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 501
diff changeset
16 APP_NAME="rhodecode"
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
17 APP_HOMEDIR="marcink/python_workspace"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
18 APP_PATH="/home/$APP_HOMEDIR/$APP_NAME"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
19
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
20 CONF_NAME="production.ini"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
21
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
22 PID_PATH="$APP_PATH/$APP_NAME.pid"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
23 LOG_PATH="$APP_PATH/$APP_NAME.log"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
24
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
25 PYTHON_PATH="/home/$APP_HOMEDIR/v-env"
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
26
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
27 RUN_AS="marcink"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
28
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
29 DAEMON="$PYTHON_PATH/bin/paster"
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
30
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
31 DAEMON_OPTS="serve --daemon \
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
32 --user=$RUN_AS \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
33 --group=$RUN_AS \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
34 --pid-file=$PID_PATH \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
35 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
36
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
37
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
38 start() {
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
39 echo "Starting $APP_NAME"
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
40 PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
41 --start --quiet \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
42 --pidfile $PID_PATH \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
43 --user $RUN_AS \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
44 --exec $DAEMON -- $DAEMON_OPTS
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
45 }
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
46
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
47 stop() {
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
48 echo "Stopping $APP_NAME"
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
49 start-stop-daemon -d $APP_PATH \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
50 --stop --quiet \
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
51 --pidfile $PID_PATH || echo "$APP_NAME - Not running!"
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
52
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
53 if [ -f $PID_PATH ]; then
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
54 rm $PID_PATH
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
55 fi
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
56 }
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
57
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
58 case "$1" in
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
59 start)
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
60 start
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
61 ;;
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
62 stop)
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
63 stop
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
64 ;;
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
65 restart)
426
17d5028e055c updated init scripts to start-stop-daemons
Marcin Kuzminski <marcin@python-works.com>
parents: 38
diff changeset
66 echo "Restarting $APP_NAME"
432
90512560ed4d more with init scripts !
Marcin Kuzminski <marcin@python-works.com>
parents: 431
diff changeset
67 ### stop ###
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
68 stop
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
69 wait
432
90512560ed4d more with init scripts !
Marcin Kuzminski <marcin@python-works.com>
parents: 431
diff changeset
70 ### start ###
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
71 start
433
aeafda5481e4 more on that neverending topic :) init scripts
Marcin Kuzminski <marcin@python-works.com>
parents: 432
diff changeset
72 ;;
12
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
73 *)
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
74 echo "Usage: $0 {start|stop|restart}"
5f30a6d558dc Added pylons manage script
Marcin Kuzminski
parents:
diff changeset
75 exit 1
1262
238bea955b54 simplified example init.d script
Marcin Kuzminski <marcin@python-works.com>
parents: 552
diff changeset
76 esac