aboutsummaryrefslogtreecommitdiffstats
path: root/usr/sbin
diff options
context:
space:
mode:
authorJan Macku <jamacku@redhat.com>2022-08-23 12:32:39 +0200
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-08-23 12:54:30 +0000
commit5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47 (patch)
treed7dec19e0d255c0aaa7417a471c054920eb418bb /usr/sbin
parent05bc43fd463ee701e5431f87e52ef6ddc1b1e1e1 (diff)
downloadinitscripts-5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47.tar
initscripts-5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47.tar.gz
initscripts-5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47.tar.bz2
initscripts-5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47.tar.xz
initscripts-5d00b7c5f74fce0ce71f6ff75b2e7042d93bce47.zip
service: Exit when `/etc/init.d` is missing
Symlink /etc/init.d -> rc.d/init.d is provided by initscripts package.
Diffstat (limited to 'usr/sbin')
-rwxr-xr-xusr/sbin/service6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr/sbin/service b/usr/sbin/service
index 4f0acc07..59099346 100755
--- a/usr/sbin/service
+++ b/usr/sbin/service
@@ -46,7 +46,8 @@ while [ $# -gt 0 ]; do
;;
*)
if [ -z "${SERVICE}" ] && [ $# -eq 1 ] && [ "${1}" = "--status-all" ]; then
- cd ${SERVICEDIR}
+ # symlink /etc/init.d -> rc.d/init.d is provided by initscripts package
+ cd ${SERVICEDIR} || { echo $"Support for initscripts isn't installed" >&2 ; exit 4 ; }
for SERVICE in * ; do
case "${SERVICE}" in
functions | halt | killall | single| linuxconf| kudzu)
@@ -61,6 +62,9 @@ while [ $# -gt 0 ]; do
done
exit 0
elif [ $# -eq 2 ] && [ "${2}" = "--full-restart" ]; then
+ # symlink /etc/init.d -> rc.d/init.d is provided by initscripts package
+ [ -L "${SERVICEDIR}" ] || { echo $"Support for initscripts isn't installed" >&2 ; exit 4 ; }
+
SERVICE="${1}"
if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" stop