forked from defunkt/cijoe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
cijoed
executable file
·53 lines (47 loc) · 1.36 KB
/
cijoed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
### BEGIN INIT INFO
# Provides: cijoe
# Required-Start: $syslog $local_fs $network
# Required-Stop: $syslog $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1
# Description: Run the CIJoe CI server. Yo Joe!!
### END INIT INFO
. /lib/lsb/init-functions
REPO=/path/to/your/git/repository
PORT=4567
NAME=cijoe
INSTALL_DIR=/usr/sbin
DAEMON=$INSTALL_DIR/$NAME
DAEMON_ARGS="-p $PORT $REPO"
PIDFILE=/var/run/$NAME.pid
DAEMON_USER=www-data
DAEMON_GROUP=$DAEMON_USER
# test -f $DAEMON || exit 0
# test -f $PROJECT_DIR || exit 0
case "$1" in
start)
log_daemon_msg "Starting cijoe" "cijoe"
start-stop-daemon --background --make-pidfile --exec $DAEMON --start --name $NAME --pidfile $PIDFILE --chuid $DAEMON_USER:$DAEMON_GROUP -- $DAEMON_ARGS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping cijoe" "cijoe"
start-stop-daemon --stop --pidfile $PIDFILE --quiet --retry 10
log_end_msg $?
;;
restart)
log_daemon_msg "Restarting cijoe" "cijoe"
start-stop-daemon --stop --pidfile $PIDFILE --quiet --retry 10
start-stop-daemon --background --make-pidfile --exec $DAEMON --start --name $NAME --pidfile $PIDFILE --chuid $DAEMON_USER:$DAEMON_GROUP -- $DAEMON_ARGS
log_end_msg $?
;;
status)
status_of_proc $DAEMON $NAME && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/cijoe (start|stop|restart)"
exit 2
;;
esac
exit 0