Skip to content

Commit d6bfbc0

Browse files
committed
common paths for crontab
1 parent 559bd69 commit d6bfbc0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

func/main.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,22 @@ sort_cron_jobs() {
473473
# Sync cronjobs with system cron
474474
sync_cron_jobs() {
475475
source $USER_DATA/user.conf
476-
rm -f /var/spool/cron/$user
476+
477+
if [ -e "/var/spool/cron/crontabs" ]; then
478+
sys_cron="/var/spool/cron/crontabs/$user"
479+
else
480+
sys_cron="/var/spool/cron/$user"
481+
fi
482+
rm -f $sys_cron
477483
if [ "$CRON_REPORTS" = 'yes' ]; then
478-
echo "MAILTO=$CONTACT" > /var/spool/cron/$user
484+
echo "MAILTO=$CONTACT" > $sys_cron
479485
fi
480486
while read line; do
481487
eval $line
482488
if [ "$SUSPENDED" = 'no' ]; then
483489
echo "$MIN $HOUR $DAY $MONTH $WDAY $CMD" |\
484490
sed -e "s/%quote%/'/g" -e "s/%dots%/:/g" \
485-
>> /var/spool/cron/$user
491+
>> $sys_cron
486492
fi
487493
done < $USER_DATA/cron.conf
488494
}

0 commit comments

Comments
 (0)