You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Against race conditions and duplicate cron entries (#10)
- **File Locking**: Uses `flock` to ensure only one update process runs at a time
- **Atomic File Operations**: Uses `mv` instead of `cat` for atomic file updates
- **Duplicate Prevention**: Tracks processed jobs to prevent duplicate cron entries
- **Unique Temp Files**: Uses process-specific temporary files to prevent conflicts
- **Proper Cleanup**: Automatic cleanup of temporary files on script exit
target_container=$(docker inspect -f '{{.Name}}'"$container"| cut -c2-)# Remove leading /
81
+
73
82
if [ -z"$cron_jobs" ];then
74
83
log "No cron jobs found for container: $target_container ($container)"
75
84
else
@@ -88,21 +97,22 @@ for container in $containers; do
88
97
# Check if both schedule and command labels are set
89
98
if [ -n"$job_schedule" ] && [ -n"$job_command" ];then
90
99
cron_entry="$job_schedule docker exec $target_container sh -c '$job_command' 2>&1 | tee -a $CRON_LOG_DIR/\$(date -u +\%Y-\%m-\%d_\%H-\%M-\%S_\%Z)_$job_key.log"
0 commit comments