чување 30d7c51fdc8281cd241efc822a68626a5a81f46e
родитељ 4cc349061b2c74a3c96692bcc585fc0dc9e182b3
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Wed, 20 Jul 2022 21:32:46 +0200
Fix activated
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 19(+), брисања: 7(-)
diff --git a/bin/service b/bin/service
@@ -43,8 +43,17 @@ seterrno()
doservice()
{
local cmd=$1 service=$2 exists=0 nooutcome=0 errno stop=0
+ local activated=0
case "${cmd}" in
+ a*d) activated=1
+ if [ "${service}" = "all" ]; then
+ nooutcome=1
+ svc -a
+ else
+ msg serv "Service %s activated?\t\t\t" ${service##*/}
+ svc -ad "${service}"
+ fi;;
a*) msg serv "Activating %s\t\t\t" ${service##*/}
svc -a "${service}";;
d*) msg serv "Deactivating %s\t\t\t" ${service##*/}
@@ -52,13 +61,13 @@ doservice()
e*) msg serv "Exists %s?\t\t\t" ${service##*/}
exists=1
svc -e "${service}";;
- l*) svc -l
- nooutcome=1;;
+ l*) nooutcome=1
+ svc -l;;
sta*) msg serv "Starting %s\t\t\t" ${service##*/}
svc -s "${service}";;
- sto*) msg serv "Stopping %s\t\t\t" ${service##*/}
- svc -k "${service}"
- stop=1;;
+ sto*) stop=1
+ msg serv "Stopping %s\t\t\t" ${service##*/}
+ svc -k "${service}";;
r*) msg serv "Restarting %s\t\t\t" ${service##*/}
svc -r "${service}";;
*) msg serv "What to do with %s?\t\t\t" ${service##*/}
@@ -69,7 +78,7 @@ doservice()
return "${errno}"
else
case ${errno} in
- 0) if [ "${exists}" -eq 1 ]; then
+ 0) if [ "${exists}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
printf "${green}( ${white}YE${norm} ${green})${norm}\n"
else
printf "${green}( ${white}OK${norm} ${green})${norm}\n"
@@ -80,7 +89,7 @@ doservice()
printf "${green}(RNNG)${norm}\n"
fi
return 1;;
- 2) if [ "${exists}" -eq 1 ]; then
+ 2) if [ "${exists}" -eq 1 ] || [ "${activated}" -eq 1 ]; then
printf "${green}( ${lred}NO${norm} ${green})${norm}\n"
else
printf "${green}(${lred}FAIL${norm}${green})${norm}\n"
diff --git a/bin/svc b/bin/svc
@@ -70,6 +70,9 @@ doservice() {
}
case "$1" in
+ -ad) if [ ! -L "run/$2" ]; then
+ exit 2
+ fi;;
-a) if [ $# -gt 1 ] && [ -e "avail/$2" ];
then
ln -sf "../avail/$2" "run/$2"