Просмотр исходного кода

Add a file exists check before deleting it.

Raphael Schneeberger 4 лет назад
Родитель
Сommit
487edcd6c8
2 измененных файлов с 8 добавлено и 3 удалено
  1. 2 1
      CHANGELOG.md
  2. 6 2
      func/main.sh

+ 2 - 1
CHANGELOG.md

@@ -5,7 +5,8 @@ All notable changes to this project will be documented in this file.
 
 ### Bugfixes
 
-- Revert #1943 Fix possible error occur for v-rebuild-cron-jobs 
+- Revert #1943 and rework it to fix possible errors occuring on v-rebuild-cron-jobs.
+- Fixed #1956 to prevent reset of defined webmail client.
 
 ## [1.4.4] - Service release
 

+ 6 - 2
func/main.sh

@@ -611,8 +611,12 @@ sync_cron_jobs() {
         crontab="/var/spool/cron/$user"
     fi
     
-    # remove file 
-    rm -f $crontab
+    # remove file if exists
+    if [ -e "$crontab" ]; then
+        rm -f $crontab
+    fi
+
+    # touch new crontab file
     touch $crontab
         
     if [ "$CRON_REPORTS" = 'yes' ]; then