forked from openSUSE/open-build-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
obsservice
executable file
·94 lines (87 loc) · 2.01 KB
/
obsservice
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#! /bin/sh
# Copyright (c) 2007, Novell Inc.
#
# Author: adrian@suse.de
#
# /etc/init.d/obsservice
# and its symbolic link
# /usr/sbin/rcobsservice
#
### BEGIN INIT INFO
# Provides: obsservice
# Required-Start: $time $syslog
# Required-Stop: $null
# Should-Start: obssrcserver
# Should-Stop: $none
# Default-Start: 3 5
# Default-Stop: 0 1 2 4 6
# Description: open build service source service server
### END INIT INFO
. /etc/rc.status
. /etc/sysconfig/obs-server
# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}
if [ -z "$OBS_RUN_DIR" ]; then
OBS_RUN_DIR="/srv/obs/run"
fi
if [ -z "$OBS_LOG_DIR" ]; then
OBS_LOG_DIR="/srv/obs/log"
fi
if [ -n "$OBS_BACKENDCODE_DIR" ]; then
obsdir="$OBS_BACKENDCODE_DIR"
else
obsdir=/usr/lib/obs/server/
fi
rundir="$OBS_RUN_DIR"
logdir="$OBS_LOG_DIR"
workdir="/var/tmp/obs_service"
rc_reset
case "$1" in
start)
echo -n "Initializing obsservice"
mkdir -p "$rundir" "$logdir" "$workdir"
chown obsrun:obsrun "$logdir" "$rundir" "$workdir"
startproc -f -l "$logdir"/src_service.log "$obsdir"/bs_service --tempdir "$workdir"
rc_status -v
;;
stop)
echo -n "Shutting down obsservice"
"$obsdir"/bs_service --stop
rc_status -v
;;
restart)
## If first returns OK call the second, if first or
## second command fails, set echo return value.
"$obsdir"/bs_service --restart
rc_status
;;
try-restart)
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
reload)
$0 status
if test $? = 0; then
touch "$rundir"/bs_service.restart
fi
rc_status
;;
status)
echo -n "Checking for obsservice and running processes: "
"$obsdir"/bs_serverstatus "$OBS_RUN_DIR"/bs_service.status
checkproc "$obsdir"/bs_service
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
exit 1
;;
esac
rc_exit