Files
openresty-gateway/scripts/uninstall-renew-cron.sh
2026-05-18 22:48:12 +08:00

21 lines
487 B
Bash

#!/usr/bin/env sh
set -eu
# Remove the cron block installed by scripts/install-renew-cron.sh.
MARK_BEGIN="# BEGIN openresty-gateway cert renew"
MARK_END="# END openresty-gateway cert renew"
if ! command -v crontab >/dev/null 2>&1; then
echo "Error: crontab is required." >&2
exit 1
fi
tmp_file="$(mktemp)"
trap 'rm -f "$tmp_file"' EXIT
crontab -l 2>/dev/null | sed "/$MARK_BEGIN/,/$MARK_END/d" > "$tmp_file"
crontab "$tmp_file"
echo "Uninstalled certificate renewal cron."