certbot-duckdns/start-certbot-duckdns.sh

32 lines
586 B
Bash
Raw Permalink Normal View History

2020-10-29 16:38:49 +01:00
#!/usr/bin/env sh
2021-03-15 20:22:21 +01:00
pids=""
run_prog() {
"$@" &
pids="$! $pids"
}
trap_sig() {
printf '%s' "$pids" | while IFS= read -r pid; do
echo "pid=$pid"
kill -s $1 $pid
done
}
trap 'trap_sig TERM' SIGTERM
# echo "Updating duckdns record"
# duckdns
# echo "Acquiering letsencrypt certificates"
# certbot-duckdns "$@"
2020-10-29 16:38:49 +01:00
echo "Starting crond"
2021-03-15 20:22:21 +01:00
printf '*/5\t*\t*\t*\t*\trun-parts /etc/periodic/5min\n' >> /etc/crontabs/root
printf '*\t*/12\t*\t*\t*\trun-parts /etc/periodic/12h\n' >> /etc/crontabs/root
crontab -l
run_prog crond -l 0 -fc /etc/crontabs/
wait $pids