Show More
@@ -0,0 +1,70 b'' | |||
|
1 | #!/bin/bash | |
|
2 | ########################################### | |
|
3 | #### THIS IS AN ARCH LINUX RC.D SCRIPT #### | |
|
4 | ########################################### | |
|
5 | ||
|
6 | . /etc/rc.conf | |
|
7 | . /etc/rc.d/functions | |
|
8 | ||
|
9 | DAEMON=rhodecode | |
|
10 | APP_HOMEDIR="/srv" | |
|
11 | APP_PATH="$APP_HOMEDIR/$DAEMON" | |
|
12 | CONF_NAME="production.ini" | |
|
13 | LOG_FILE="/var/log/$DAEMON.log" | |
|
14 | PID_FILE="/run/daemons/$DAEMON" | |
|
15 | APPL=/usr/bin/paster | |
|
16 | RUN_AS="*****" | |
|
17 | ||
|
18 | ARGS="serve --daemon \ | |
|
19 | --user=$RUN_AS \ | |
|
20 | --group=$RUN_AS \ | |
|
21 | --pid-file=$PID_FILE \ | |
|
22 | --log-file=$LOG_FILE \ | |
|
23 | $APP_PATH/$CONF_NAME" | |
|
24 | ||
|
25 | [ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON | |
|
26 | ||
|
27 | if [[ -r $PID_FILE ]]; then | |
|
28 | read -r PID < "$PID_FILE" | |
|
29 | if [[ $PID && ! -d /proc/$PID ]]; then | |
|
30 | unset PID | |
|
31 | rm_daemon $DAEMON | |
|
32 | fi | |
|
33 | fi | |
|
34 | ||
|
35 | case "$1" in | |
|
36 | start) | |
|
37 | stat_busy "Starting $DAEMON" | |
|
38 | export HOME=$APP_PATH | |
|
39 | [ -z "$PID" ] && $APPL $ARGS &>/dev/null | |
|
40 | if [ $? = 0 ]; then | |
|
41 | add_daemon $DAEMON | |
|
42 | stat_done | |
|
43 | else | |
|
44 | stat_fail | |
|
45 | exit 1 | |
|
46 | fi | |
|
47 | ;; | |
|
48 | stop) | |
|
49 | stat_busy "Stopping $DAEMON" | |
|
50 | [ -n "$PID" ] && kill $PID &>/dev/null | |
|
51 | if [ $? = 0 ]; then | |
|
52 | rm_daemon $DAEMON | |
|
53 | stat_done | |
|
54 | else | |
|
55 | stat_fail | |
|
56 | exit 1 | |
|
57 | fi | |
|
58 | ;; | |
|
59 | restart) | |
|
60 | $0 stop | |
|
61 | sleep 1 | |
|
62 | $0 start | |
|
63 | ;; | |
|
64 | status) | |
|
65 | stat_busy "Checking $name status"; | |
|
66 | ck_status $name | |
|
67 | ;; | |
|
68 | *) | |
|
69 | echo "usage: $0 {start|stop|restart|status}" | |
|
70 | esac No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now