Files
sxmo-utils/scripts/core/sxmo_run_aligned.sh
Stacy Harper a2405f6d57 Fix shellspec
2022-11-15 13:41:55 +01:00

25 lines
309 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
timeout="$1"
shift
finish() {
kill "$CMDPID"
kill "$SLEEPPID"
exit 0
}
trap 'finish' TERM INT
while : ; do
"$@" &
CMDPID="$!"
wait "$CMDPID"
sxmo_aligned_sleep "$timeout" &
SLEEPPID="$!"
wait "$SLEEPPID"
done