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

Fix issue with v-rebuild-cron-jobs

Jaap Marcus 4 лет назад
Родитель
Сommit
a6eb339d3f
2 измененных файлов с 12 добавлено и 1 удалено
  1. 6 0
      CHANGELOG.md
  2. 6 1
      func/main.sh

+ 6 - 0
CHANGELOG.md

@@ -1,6 +1,12 @@
 # Changelog
 All notable changes to this project will be documented in this file.
 
+## [1.4.5] - Service release
+
+### Bugfixes
+
+- Revert #1943 Fix possible error occur for v-rebuild-cron-jobs 
+
 ## [1.4.4] - Service release
 
 ### Features

+ 6 - 1
func/main.sh

@@ -610,11 +610,16 @@ sync_cron_jobs() {
     else
         crontab="/var/spool/cron/$user"
     fi
-    >$crontab
+    
+    # remove file 
+    rm -f $crontab
+    touch $crontab
+        
     if [ "$CRON_REPORTS" = 'yes' ]; then
         echo "MAILTO=$CONTACT" > $crontab
         echo 'CONTENT_TYPE="text/plain; charset=utf-8"' >> $crontab
     fi
+    
     while read line; do
         parse_object_kv_list "$line"
         if [ "$SUSPENDED" = 'no' ]; then