Reset sxmo_run_periodically.sh wait first feature

This commit is contained in:
Willow Barraco
2023-04-28 11:57:35 +02:00
parent 2691b8cca6
commit f5dd68bc75

View File

@@ -2,6 +2,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
if [ "$1" = "-" ]; then
waitfirst=1
shift
fi
timeout="$1"
shift
@@ -13,6 +18,13 @@ finish() {
trap 'finish' TERM INT
if [ -n "$waitfirst" ]; then
sleep "$timeout" &
SLEEPPID="$!"
wait "$SLEEPPID"
unset SLEEPPID
fi
while : ; do
"$@" &
CMDPID="$!"