##// END OF EJS Templates
Added header for redhat init.d script...
marcink -
r1545:a7bee2a5 beta
parent child Browse files
Show More
@@ -1,14 +1,14 b''
1 List of contributors to RhodeCode project:
1 List of contributors to RhodeCode project:
2 Marcin Kuźmiński <marcin@python-works.com>
2 Marcin Kuźmiński <marcin@python-works.com>
3 Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
3 Lukasz Balcerzak <lukaszbalcerzak@gmail.com>
4 Jason Harris <jason@jasonfharris.com>
4 Jason Harris <jason@jasonfharris.com>
5 Thayne Harbaugh <thayne@fusionio.com>
5 Thayne Harbaugh <thayne@fusionio.com>
6 cejones
6 cejones
7 Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>
7 Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>
8 Dmitri Kuznetsov
8 Dmitri Kuznetsov
9 Jared Bunting <jared.bunting@peachjean.com>
9 Jared Bunting <jared.bunting@peachjean.com>
10 Steve Romanow <slestak989@gmail.com>
10 Steve Romanow <slestak989@gmail.com>
11 Augosto Hermann <augusto.herrmann@planejamento.gov.br>
11 Augosto Hermann <augusto.herrmann@planejamento.gov.br>
12 Ankit Solanki <ankit.solanki@gmail.com>
12 Ankit Solanki <ankit.solanki@gmail.com>
13 Liad Shani <liadff@gmail.com>
13 Liad Shani <liadff@gmail.com>
14
14 Les Peabody <lpeabody@gmail.com>
@@ -1,128 +1,132 b''
1 #!/bin/sh
1 #!/bin/sh
2 ########################################
3 #### THIS IS A REDHAT INIT.D SCRIPT ####
4 ########################################
5
2 ##################################################
6 ##################################################
3 #
7 #
4 # RhodeCode server startup script
8 # RhodeCode server startup script
5 # Recommended default-startup: 2 3 4 5
9 # Recommended default-startup: 2 3 4 5
6 # Recommended default-stop: 0 1 6
10 # Recommended default-stop: 0 1 6
7 #
11 #
8 ##################################################
12 ##################################################
9
13
10
14
11 APP_NAME="rhodecode"
15 APP_NAME="rhodecode"
12 # the location of your app
16 # the location of your app
13 # since this is a web app, it should go in /var/www
17 # since this is a web app, it should go in /var/www
14 APP_PATH="/var/www/$APP_NAME"
18 APP_PATH="/var/www/$APP_NAME"
15
19
16 CONF_NAME="production.ini"
20 CONF_NAME="production.ini"
17
21
18 # write to wherever the PID should be stored, just ensure
22 # write to wherever the PID should be stored, just ensure
19 # that the user you run paster as has the appropriate permissions
23 # that the user you run paster as has the appropriate permissions
20 # same goes for the log file
24 # same goes for the log file
21 PID_PATH="/var/run/rhodecode/pid"
25 PID_PATH="/var/run/rhodecode/pid"
22 LOG_PATH="/var/log/rhodecode/rhodecode.log"
26 LOG_PATH="/var/log/rhodecode/rhodecode.log"
23
27
24 # replace this with the path to the virtual environment you
28 # replace this with the path to the virtual environment you
25 # made for RhodeCode
29 # made for RhodeCode
26 PYTHON_PATH="/opt/python_virtualenvironments/rhodecode-venv"
30 PYTHON_PATH="/opt/python_virtualenvironments/rhodecode-venv"
27
31
28 RUN_AS="rhodecode"
32 RUN_AS="rhodecode"
29
33
30 DAEMON="$PYTHON_PATH/bin/paster"
34 DAEMON="$PYTHON_PATH/bin/paster"
31
35
32 DAEMON_OPTS="serve --daemon \
36 DAEMON_OPTS="serve --daemon \
33 --user=$RUN_AS \
37 --user=$RUN_AS \
34 --group=$RUN_AS \
38 --group=$RUN_AS \
35 --pid-file=$PID_PATH \
39 --pid-file=$PID_PATH \
36 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
40 --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
37
41
38 DESC="rhodecode-server"
42 DESC="rhodecode-server"
39 LOCK_FILE="/var/lock/subsys/$APP_NAME"
43 LOCK_FILE="/var/lock/subsys/$APP_NAME"
40
44
41 # source CentOS init functions
45 # source CentOS init functions
42 . /etc/init.d/functions
46 . /etc/init.d/functions
43
47
44 RETVAL=0
48 RETVAL=0
45
49
46 remove_pid () {
50 remove_pid () {
47 rm -f ${PID_PATH}
51 rm -f ${PID_PATH}
48 rmdir `dirname ${PID_PATH}`
52 rmdir `dirname ${PID_PATH}`
49 }
53 }
50
54
51 ensure_pid_dir () {
55 ensure_pid_dir () {
52 PID_DIR=`dirname ${PID_PATH}`
56 PID_DIR=`dirname ${PID_PATH}`
53 if [ ! -d ${PID_DIR} ] ; then
57 if [ ! -d ${PID_DIR} ] ; then
54 mkdir -p ${PID_DIR}
58 mkdir -p ${PID_DIR}
55 chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR}
59 chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR}
56 chmod 755 ${PID_DIR}
60 chmod 755 ${PID_DIR}
57 fi
61 fi
58 }
62 }
59
63
60 start_rhodecode () {
64 start_rhodecode () {
61 ensure_pid_dir
65 ensure_pid_dir
62 PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \
66 PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \
63 --user $RUN_AS "$DAEMON $DAEMON_OPTS"
67 --user $RUN_AS "$DAEMON $DAEMON_OPTS"
64 RETVAL=$?
68 RETVAL=$?
65 [ $RETVAL -eq 0 ] && touch $LOCK_FILE
69 [ $RETVAL -eq 0 ] && touch $LOCK_FILE
66 return $RETVAL
70 return $RETVAL
67 }
71 }
68
72
69 stop_rhodecode () {
73 stop_rhodecode () {
70 if [ -e $LOCK_FILE ]; then
74 if [ -e $LOCK_FILE ]; then
71 killproc -p $PID_PATH
75 killproc -p $PID_PATH
72 RETVAL=$?
76 RETVAL=$?
73 rm -f $LOCK_FILE
77 rm -f $LOCK_FILE
74 rm -f $PID_PATH
78 rm -f $PID_PATH
75 else
79 else
76 RETVAL=1
80 RETVAL=1
77 fi
81 fi
78 return $RETVAL
82 return $RETVAL
79 }
83 }
80
84
81 status_rhodecode() {
85 status_rhodecode() {
82 if [ -e $LOCK_FILE ]; then
86 if [ -e $LOCK_FILE ]; then
83 # exit with non-zero to indicate failure
87 # exit with non-zero to indicate failure
84 RETVAL=1
88 RETVAL=1
85 else
89 else
86 RETVAL=0
90 RETVAL=0
87 fi
91 fi
88 return $RETVAL
92 return $RETVAL
89 }
93 }
90
94
91 restart_rhodecode () {
95 restart_rhodecode () {
92 stop_rhodecode
96 stop_rhodecode
93 start_rhodecode
97 start_rhodecode
94 RETVAL=$?
98 RETVAL=$?
95 }
99 }
96
100
97 case "$1" in
101 case "$1" in
98 start)
102 start)
99 echo -n $"Starting $DESC: "
103 echo -n $"Starting $DESC: "
100 start_rhodecode
104 start_rhodecode
101 echo
105 echo
102 ;;
106 ;;
103 stop)
107 stop)
104 echo -n $"Stopping $DESC: "
108 echo -n $"Stopping $DESC: "
105 stop_rhodecode
109 stop_rhodecode
106 echo
110 echo
107 ;;
111 ;;
108 status)
112 status)
109 status_rhodecode
113 status_rhodecode
110 RETVAL=$?
114 RETVAL=$?
111 if [ ! $RETVAL -eq 0 ]; then
115 if [ ! $RETVAL -eq 0 ]; then
112 echo "RhodeCode server is running..."
116 echo "RhodeCode server is running..."
113 else
117 else
114 echo "RhodeCode server is stopped."
118 echo "RhodeCode server is stopped."
115 fi
119 fi
116 ;;
120 ;;
117 restart)
121 restart)
118 echo -n $"Restarting $DESC: "
122 echo -n $"Restarting $DESC: "
119 restart_rhodecode
123 restart_rhodecode
120 echo
124 echo
121 ;;
125 ;;
122 *)
126 *)
123 echo $"Usage: $0 {start|stop|restart|status}"
127 echo $"Usage: $0 {start|stop|restart|status}"
124 RETVAL=1
128 RETVAL=1
125 ;;
129 ;;
126 esac
130 esac
127
131
128 exit $RETVAL No newline at end of file
132 exit $RETVAL
General Comments 0
You need to be logged in to leave comments. Login now