чување 095152996130b84b63f9b45c8de338a98566f064
родитељ 47642a1f31e251d08af247b3c0012ed39cfdcacf
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Tue, 2 Aug 2022 15:50:44 +0200
exists -> running
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 3, додавања: 17(+), брисања: 17(-)
diff --git a/README.md b/README.md
@@ -41,7 +41,7 @@ special variable from /bin/svc.d/default/somebin.
% svc -a ser # activate service »ser« to be run on startup
% svc -c # create the basic directories of svc (configure)
% svc -d ser # deactivate service »ser«
- % svc -e ser # test if service »ser« exists
+ % svc -e ser # test if service »ser« is running
% svc -k # kill all services linked to /bin/svc.d/run
% svc -k ser # kill the service »ser«
% svc -s # run all services linked to /bin/svc.d/run
diff --git a/bin/service b/bin/service
@@ -23,8 +23,8 @@ fi
usage()
{
- printf "usage: %s [a(ctivated?)|d(eactivate)|e(xists)|l(ist)|"\
-"sta(rt)|sto(p)|r(estart)] [service|all]\n" "${0##*/}" >&2
+ printf "usage: %s [a(ctivated?)|d(eactivate)|l(ist)|sta(rt)|sto(p)|"\
+"re(start)|ru(nning)] [service|all]\n" "${0##*/}" >&2
}
if [ $# -lt 1 ]; then
@@ -37,7 +37,7 @@ service="$2"
doservice()
{
- local cmd=$1 service=$2 exists=0 nooutcome=0 errno stop=0
+ local cmd=$1 service=$2 running=0 nooutcome=0 errno stop=0
local activated=0
case "${cmd}" in
@@ -70,8 +70,8 @@ doservice()
msg err "No service given"
exit 2
else
- msg serv "Exists %s?\t\t\t" ${service##*/}
- exists=1
+ msg serv "%s running?\t\t\t" ${service##*/}
+ running=1
svc -e "${service}" 2>/dev/null
fi;;
l*) nooutcome=1
@@ -115,18 +115,18 @@ doservice()
return "${errno}"
else
case ${errno} in
- 0) if [ "${exists}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
+ 0) if [ "${running}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
printf "${green}(${white} YE ${norm}${green})${norm}\n"
else
printf "${green}(${white} OK ${norm}${green})${norm}\n"
fi;;
- 1) if [ "${exists}" -eq 1 ]; then
+ 1) if [ "${running}" -eq 1 ]; then
printf "${green}(${gray}1-ST${norm}${green})${norm}\n"
else
printf "${green}(${gray}RNNG${norm}${green})${norm}\n"
fi
return 1;;
- 2) if [ "${exists}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
+ 2) if [ "${running}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
printf "${green}(${lred} NO ${norm}${green})${norm}\n"
else
printf "${green}(${lred}FAIL${norm}${green})${norm}\n"
@@ -153,7 +153,7 @@ if [ "${service}" = "all" ]; then
doservice "${cmd}" "${service##*/}"
done
case ${cmd} in
- sta*|sto*|r*) sleep 1; service exists all;;
+ sta*|sto*|r*) sleep 1; service running all;;
*) ;;
esac;;
esac
diff --git a/man/man8/service.8 b/man/man8/service.8
@@ -40,18 +40,18 @@ is activated in
deactivates the service
.Dq Ar service .
.
-.It Nm Cm e(xists) Op Ar service | Cm all
-checks if the service
-.Dq Ar service
-is running.
-.
.It Nm Cm l(ist)
lists all available (not necessarily activated) services in the directory
.Pa /bin/svc.d/avail .
.
-.It Nm Cm r(estart) Op Ar service | Cm all
+.It Nm Cm re(start) Op Ar service | Cm all
restarts the service.
.
+.It Nm Cm ru(nning) Op Ar service | Cm all
+checks if the service
+.Dq Ar service
+is running.
+.
.It Nm Cm sta(rt) Op Ar service | Cm all
starts the service.
.
@@ -83,7 +83,7 @@ the service isn't running.
the service is
.Dq one-shot ,
so the
-.Cm exists
+.Cm running
operation doesn't apply.
.It RNNG
the service is already running.