-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathts-manage-cron.sh
28 lines (25 loc) · 991 Bytes
/
ts-manage-cron.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#-----------------------------------------------------------------------------
# Tailscale Certificate Renewal Scheduler
#
# Purpose:
# - Manages automated certificate renewal via cron
# - Prevents duplicate cron entries
# - Logs renewal attempts for monitoring
#
# Schedule: Every Saturday at 12:00 AM (Midnight)
#-----------------------------------------------------------------------------
# Cron Configuration
# Format: Minute Hour Day Month DayOfWeek Command
# 0 0 * * 6 = At 00:00 (12:00 AM) on Saturday
CRON_JOB="0 0 * * 6 ts-certgen.sh >> /ts-certgen.log 2>&1"
# Cron Job Management
# Check existing crontab for duplicate entries
echo "[INFO] Verifying cron configuration..."
if ! crontab -l | grep -Fxq "$CRON_JOB"; then
echo "[INFO] Installing certificate renewal schedule..."
(crontab -l ; echo "$CRON_JOB") | crontab -
echo "[SUCCESS] Scheduled certificate renewal for Saturday 12:00 AM"
else
echo "[INFO] Certificate renewal schedule already exists"
fi