Improve shell code.
This commit is contained in:
parent
53300b1004
commit
8669ccb9c1
1 changed files with 10 additions and 5 deletions
|
@ -24,7 +24,7 @@ fi
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
printf "Starting daemontools: "
|
printf "Starting daemontools: "
|
||||||
if [ ! "$(pidof svscan)" ]; then
|
if ! pidof svscan > /dev/null 2>&1; then
|
||||||
printf "svscan "
|
printf "svscan "
|
||||||
env - PATH="$PATH" svscan /service 2>&1 | setuidgid daemon multilog t /var/log/svscan &
|
env - PATH="$PATH" svscan /service 2>&1 | setuidgid daemon multilog t /var/log/svscan &
|
||||||
echo "."
|
echo "."
|
||||||
|
@ -34,11 +34,16 @@ case "$1" in
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
printf "Stopping daemontools: "
|
printf "Stopping daemontools: "
|
||||||
if [ "$(pidof svscan)" ]; then
|
pids="$(pidof svscan)"
|
||||||
|
if [ -n "${pids}" ]
|
||||||
|
then
|
||||||
printf "svscan"
|
printf "svscan"
|
||||||
while [ "$(pidof svscan)" ]; do
|
while [ -n "${pids}" ]
|
||||||
kill "$(pidof svscan)"
|
do
|
||||||
|
# shellcheck disable=SC2086
|
||||||
|
kill ${pids}
|
||||||
printf "."
|
printf "."
|
||||||
|
pids="$(pidof svscan)"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
printf " services"
|
printf " services"
|
||||||
|
|
Loading…
Reference in a new issue