obs-server/0004-remove-systemV-method.patch
2021-08-21 17:33:16 +08:00

175 lines
4.5 KiB
Diff

From 7d2d404c36e68ba7aaa1192f72c9f0e5524aa7ff Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Thu, 17 Jun 2021 09:39:39 +0800
Subject: [PATCH] patch
---
dist/obsscheduler | 35 +++-------------------------------
dist/obsworker | 48 +++--------------------------------------------
2 files changed, 6 insertions(+), 77 deletions(-)
diff --git a/dist/obsscheduler b/dist/obsscheduler
index d7f49db..66af2d0 100755
--- a/dist/obsscheduler
+++ b/dist/obsscheduler
@@ -3,8 +3,6 @@
#
# Author: adrian@suse.de
-. /etc/rc.status
-
. /etc/sysconfig/obs-server
# Determine the base and follow a runlevel link name.
@@ -42,22 +40,18 @@ if test -z "$OBS_SCHEDULER_ARCHITECTURES" ; then
fi
-rc_reset
case "$1" in
start)
- echo -n "Initializing obsscheduler"
mkdir -p "$rundir" "$logdir"
chown obsrun:obsrun "$logdir" "$rundir"
cd "$obsdir"
# FIXME: not nice, this should receive a proper daemon handling,
# including real logging, pid file and startproc
for i in $OBS_SCHEDULER_ARCHITECTURES; do
- ./bs_sched $i >> "$logdir"/scheduler_$i.log 2>&1 &
+ $OBS_SCHEDULER_WRAPPER ./bs_sched $i >> "$logdir"/scheduler_$i.log 2>&1 &
done
- rc_status -v
;;
- stop|shutdown)
- echo -n "Shutting down obsscheduler"
+ stop)
if checkproc bs_sched; then
for i in $OBS_SCHEDULER_ARCHITECTURES; do
$obsdir/bs_admin --shutdown-scheduler "$i"
@@ -70,32 +64,9 @@ case "$1" in
killall bs_sched
fi
fi
- rc_status -v
- ;;
- restart)
- $0 stop
- $0 start
- rc_status
- ;;
- try-restart|reload)
- $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
- ;;
- status)
- echo -n "Checking for obsscheduler: "
- # FIXME: needs proper checking for all invoked schedulers
- checkproc bs_sched
- rc_status -v
;;
*)
- echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
+ echo "Usage: $0 {start|stop}"
exit 1
;;
esac
-rc_exit
diff --git a/dist/obsworker b/dist/obsworker
index 7d991ba..85e4f8b 100755
--- a/dist/obsworker
+++ b/dist/obsworker
@@ -4,22 +4,6 @@
# Author: adrian@suse.de
#
# /etc/init.d/obsworker
-# and its symbolic link
-# /usr/sbin/rcobsworker
-#
-### BEGIN INIT INFO
-# Provides: obsworker
-# Required-Start: $time $network $syslog
-# Required-Stop: $time $network $syslog
-# Should-Start: $remote_fs obsstoragesetup obssrcserver obsrepserver xendomains
-# Should-Stop: $none
-# Default-Start: 3 5
-# Default-Stop: 0 1 2 4 6
-# Short-Description: OBS worker
-# Description: Open Build Service worker
-### END INIT INFO
-
-. /etc/rc.status
# Is the worker running on Fedora >= 17 ?
# It lacks the complete path to build other distros then
@@ -334,7 +318,6 @@ EOF
fi
}
-rc_reset
case "$1" in
start)
# reset screenrc
@@ -353,8 +336,8 @@ case "$1" in
NUM=`ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l`
fi
if [ "--zvm" == "$vmopt" ]; then
- check_vmcp || rc_status -v
- create_initrd $OBS_VM_KERNEL $OBS_VM_INITRD || rc_status -v
+ check_vmcp || exit 1
+ create_initrd $OBS_VM_KERNEL $OBS_VM_INITRD || exit 1
if [ -n "$OBS_WORKER_INSTANCE_NAMES" ]; then
WORKERS=($OBS_WORKER_INSTANCE_NAMES)
NUM=${#WORKERS[*]}
@@ -483,7 +466,6 @@ case "$1" in
popd > /dev/null
;;
stop)
- echo -n "Shutting down obsworker"
for I in "$workerdir"/*; do
test -d "$I" || continue
test -e "$I/state" || continue
@@ -496,33 +478,9 @@ case "$1" in
sleep 2
killall -s 9 bs_worker 2>/dev/null
screen -S obsworker -X quit
- rc_status -v
- ;;
- restart)
- ## If first returns OK call the second, if first or
- ## second command fails, set echo return value.
- $0 stop
- $0 start
- rc_status
- ;;
- try-restart|reload)
- $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
- ;;
- status)
- echo -n "Checking for obsworker: "
- checkproc bs_worker
- rc_status -v
;;
*)
- echo "Usage: $0 {start|stop|status|try-restart|restart|reload}"
+ echo "Usage: $0 {start|stop}"
exit 1
;;
esac
-rc_exit
--
2.27.0