/[smeserver]/rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz9672.servicesystemd.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme10/e-smith-base-5.8.0-bz9672.servicesystemd.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Sun Jun 6 20:38:43 2021 UTC (3 years ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
5.8.1

1 diff -up e-smith-base-5.8.0/root/sbin/e-smith/service.bz9672.servicesystemd e-smith-base-5.8.0/root/sbin/e-smith/service
2 --- e-smith-base-5.8.0/root/sbin/e-smith/service.bz9672.servicesystemd 2016-02-04 18:14:13.000000000 -0500
3 +++ e-smith-base-5.8.0/root/sbin/e-smith/service 2016-07-23 09:28:59.034000000 -0400
4 @@ -1,13 +1,53 @@
5 #! /bin/sh
6 +# prevent initscript to use systemctl
7 +export SYSTEMCTL_SKIP_REDIRECT=1
8 +. /etc/rc.d/init.d/functions
9
10 -runlevel=$(runlevel | cut -d" " -f2)
11 +# what is our current runlevel
12 +runlevel=$(systemctl get-default)
13 +SERVICE=$1
14 +USAGE="Usage: service SERVICENAME [ACTION]"
15
16 -if [ "$runlevel" = "4" ]
17 +#if no servicename is provided return usage
18 +if [[ "${SERVICE}" == "" ]]
19 +then
20 + echo ${USAGE} >&2
21 + exit
22 +fi
23 +
24 +if [ "$runlevel" = "multi-user.target" ]
25 then
26 if ls /etc/rc7.d/S??$1 >/dev/null 2>/dev/null
27 then
28 script=$(ls /etc/rc7.d/S??$1 | head -1)
29 exec $script $2
30 +
31 + elif ls /usr/lib/systemd/system/${SERVICE}.service >/dev/null 2>/dev/null || ls /etc/systemd/system/${SERVICE}.service >/dev/null 2>/dev/null
32 + then
33 + if [[ "$2" == "" ]] ; then
34 + echo "'$1' requires an action" 1>&2
35 + echo ${USAGE} >&2
36 + exit
37 + elif [[ $2 == "status" ]] ; then
38 + exec /bin/systemctl status -n0 ${SERVICE}
39 + exit
40 + elif [[ $2 == "start" ]] ; then
41 + echo -n "Starting ${SERVICE}" 2>/dev/null
42 + elif [[ $2 == "stop" ]] ; then
43 + echo -n "Stopping ${SERVICE}" 2>/dev/null
44 + elif [[ $2 == "restart" ]] ; then
45 + echo -n "Restarting ${SERVICE}" 2>/dev/null
46 + else
47 + echo -n "Sending $2 signal to ${SERVICE}" 2>/dev/null
48 + fi
49 + /bin/systemctl $2 ${SERVICE}.service> /dev/null
50 + if [ $? -ne 0 ]; then
51 + echo_failure
52 + else
53 + echo_success
54 + fi
55 + echo
56 + exit
57 fi
58
59 echo "'$1' is not a valid service name" 1>&2

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed