чување 455a9cde59eac1db06731a27ca77d03bd73b3e47
родитељ 3b59bfe6fd6d28a1a0b2a1f92a1cc80761d9b689
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sat, 13 Aug 2022 17:40:42 +0200
Add STATUSDELAY
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 15(+), брисања: 2(-)
diff --git a/bin/service b/bin/service
@@ -8,6 +8,7 @@
# 2: Error
BASEDIR=/bin/svc.d
+STATUSDELAY=${STATUSDELAY:-1}
if [ -e /lib/g_fun.sh ]; then
. /lib/g_fun.sh
@@ -162,9 +163,11 @@ if [ "${service}" = "all" ]; then
done
case ${cmd} in
sto*) stop=1; export stop
- sleep 1; service running all
+ sleep "${STATUSDELAY}"
+ service running all
unset stop;;
- sta*|re*) sleep 1; service running all;;
+ sta*|re*) sleep "${STATUSDELAY}"
+ service running all;;
*) ;;
esac;;
esac
diff --git a/man/man8/service.8 b/man/man8/service.8
@@ -58,6 +58,16 @@ starts the service.
.It Nm Cm sto(p) Op Ar service | Cm all
stops the service.
.El
+.Sh ENVIRONMENT
+.Bl -tag -width ".Ev STATUSDELAY"
+.It Ev STATUSDELAY
+Delay between issuing
+.Ql service start all
+and
+.Ql service running all ,
+in seconds. Default value is 1. Adjust as necessary to leave time for services
+to start before querying their status.
+.El
.Sh FILES
.Bl -tag -width ".Pa /bin/svc.d/avail"
.It Pa /bin/svc.d/avail