aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2019-12-10 11:40:51 +0100
committerGitHub <noreply@github.com>2019-12-10 11:40:51 +0100
commitb54210c1e18b2ae4d075572ff955fdc7c56b8d98 (patch)
treee3956eb33a8d02abd11829f9c554022c349ce562
parent82e2a94703a487fc53f3defe6b37f1e9da35fd0e (diff)
downloadinitscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar
initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.gz
initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.bz2
initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.xz
initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.zip
Fix service network stop cmd
-rwxr-xr-xusr/sbin/service7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr/sbin/service b/usr/sbin/service
index 31d8f3e1..b4712002 100755
--- a/usr/sbin/service
+++ b/usr/sbin/service
@@ -78,6 +78,13 @@ if [ -f "${SERVICEDIR}/${SERVICE}" ]; then
systemctl show -p SubState ${SERVICE}.service | grep -q '=exited$' ; then
/bin/systemctl stop ${SERVICE}.service
fi
+ # Workaround to be able to "stop" network.service when it's in inactive state using service instead of systemctl
+ # Useful for manual testing of network
+ if [ "${SERVICE}" = 'network' ] && [ "${ACTION}" = 'stop' ] && \
+ [ "$(systemctl show -p ActiveState network.service --value)" = 'inactive' ] && \
+ [ "$(systemctl show -p SourcePath network.service --value)" = '/etc/rc.d/init.d/network' ]; then
+ export SYSTEMCTL_SKIP_REDIRECT=1
+ fi
env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
elif [ -n "${ACTION}" ] && [ -x "${ACTIONDIR}/${SERVICE}/${ACTION}" ]; then
env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${ACTIONDIR}/${SERVICE}/${ACTION}" ${OPTIONS}