We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ce3c728 + 7bcfe3d commit f5b46c3Copy full SHA for f5b46c3
setup.sh
@@ -314,10 +314,17 @@ add_cron_job() {
314
fi
315
316
# List the current crontab
317
- if ! $crontab_cmd -l 2>/dev/null > "$temp_cron"; then
318
- log "CRITICAL" "Unable to list current crontab."
319
- rm "$temp_cron"
320
- exit 1
+ if ! $crontab_cmd -l > "$temp_cron" 2>&1; then
+ # Handle empty cron file error
+ if grep -q "no crontab for" "$temp_cron" 2>/dev/null; then
+ grep -v "no crontab for" "$temp_cron" > "${temp_cron}.clean"
321
+ mv "${temp_cron}.clean" "$temp_cron"
322
+ log "No crontab for user $USER_NAME."
323
+ else
324
+ log "CRITICAL" "Unable to list current crontab. hello"
325
+ rm "$temp_cron"
326
+ exit 1
327
+ fi
328
329
330
# Ensure the cron job does not already exist
0 commit comments