diff options
author | Jan Macku <jamacku@redhat.com> | 2019-12-10 11:40:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-10 11:40:51 +0100 |
commit | b54210c1e18b2ae4d075572ff955fdc7c56b8d98 (patch) | |
tree | e3956eb33a8d02abd11829f9c554022c349ce562 | |
parent | 82e2a94703a487fc53f3defe6b37f1e9da35fd0e (diff) | |
download | initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.gz initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.bz2 initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.tar.xz initscripts-b54210c1e18b2ae4d075572ff955fdc7c56b8d98.zip |
Fix service network stop cmd
-rwxr-xr-x | usr/sbin/service | 7 |
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} |