31 lines
463 B
Bash
Executable file
31 lines
463 B
Bash
Executable file
#!/bin/sh
|
|
|
|
pids=""
|
|
|
|
run_prog() {
|
|
"$@" &
|
|
pids="$! $pids"
|
|
}
|
|
|
|
trap_sig() {
|
|
printf '%s' "$pids" | while IFS= read -r pid; do
|
|
echo "pid=$pid"
|
|
# shellcheck disable=2086
|
|
kill -s $1 $pid
|
|
done
|
|
}
|
|
|
|
trap 'trap_sig TERM' TERM
|
|
|
|
# default to every 5 minutes
|
|
DELAY="${OVHDDNS_INTERVAL_SECONDS:-300}"
|
|
|
|
stdin_content="$(cat -)"
|
|
|
|
while :; do
|
|
echo "$stdin_content" | ovhddns "$@"
|
|
run_prog sleep "$DELAY"
|
|
wait $pids
|
|
pids=
|
|
done
|
|
|