fix empty cron
This commit is contained in:
parent
1d146dd0d4
commit
22981eac7f
@ -14,7 +14,7 @@ if [ ! -f $CRON_LIST ]; then
|
||||
fi
|
||||
|
||||
echo "Reading current crontab jobs into a variable..."
|
||||
current_crontab=$(crontab -l 2>/dev/null || :)
|
||||
current_crontab=$(crontab -l 2>/dev/null || true)
|
||||
|
||||
echo "Iterate through the lines of the cron.list file..."
|
||||
while IFS= read -r line; do
|
||||
@ -28,7 +28,7 @@ while IFS= read -r line; do
|
||||
echo "The task already exists: $line"
|
||||
else
|
||||
echo "Adding a job to crontab..."
|
||||
(crontab -l; echo "$line") | crontab -
|
||||
(crontab -l 2>/dev/null || true; echo "$line") | crontab -
|
||||
echo "Task added: $line"
|
||||
fi
|
||||
done < "$CRON_LIST"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user