Skip to content

Commit 33e266f

Browse files
authored
Fix possible error occur for v-rebuild-cron-jobs
Since crontab was removed on line 613, if no cronjob being added during the process, it will trigger error on line 626, 627 for No such file or directory
1 parent 0675980 commit 33e266f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

func/main.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ sync_cron_jobs() {
610610
else
611611
crontab="/var/spool/cron/$user"
612612
fi
613-
rm -f $crontab
613+
>$crontab
614614
if [ "$CRON_REPORTS" = 'yes' ]; then
615615
echo "MAILTO=$CONTACT" > $crontab
616616
echo 'CONTENT_TYPE="text/plain; charset=utf-8"' >> $crontab
@@ -1304,4 +1304,4 @@ no_symlink_chmod() {
13041304

13051305
chmod "${filemode}" "${i}"
13061306
done
1307-
}
1307+
}

0 commit comments

Comments
 (0)