Browse Source

Keep spamassassin running

Bob Mottram 8 years ago
parent
commit
01cb6306a2
1 changed files with 15 additions and 0 deletions
  1. 15
    0
      src/freedombone-base-email

+ 15
- 0
src/freedombone-base-email View File

1193
     # this must be accessible by root
1193
     # this must be accessible by root
1194
     chown -R $MY_USERNAME:root /home/$MY_USERNAME/.spamassassin
1194
     chown -R $MY_USERNAME:root /home/$MY_USERNAME/.spamassassin
1195
 
1195
 
1196
+    # script to keep spamassassin running
1197
+    # There is a systemd script from the debian package, but it doesn't restart on failure
1198
+    # and also doesn't ensure start after networking is up. If that is eventually fixed
1199
+    # then this script and the cron job which runs it can be removed.
1200
+    script_name=/usr/bin/run-spamassassin
1201
+    echo '#!/bin/bash' > $script_name
1202
+    echo 'current_state=$(systemctl status spamassassin)' >> $script_name
1203
+    echo 'if [[ "$current_state" != *"(running)"* ]]; then' >> $script_name
1204
+    echo '    systemctl restart spamassassin' >> $script_name
1205
+    echo 'fi' >> $script_name
1206
+    echo 'exit 0' >> $script_name
1207
+    chmod +x $script_name
1208
+
1196
     systemctl start spamassassin
1209
     systemctl start spamassassin
1197
     systemctl restart exim4
1210
     systemctl restart exim4
1198
     systemctl restart cron
1211
     systemctl restart cron
1212
+    function_check cron_add_mins
1213
+    cron_add_mins 10 "$script_name 2> /dev/null"
1199
 
1214
 
1200
     mark_completed $FUNCNAME
1215
     mark_completed $FUNCNAME
1201
 }
1216
 }