X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=9ada9b6c5060c54ba2e8d1e3ca1df52c642634e9;hb=HEAD;hp=cdbf9e8ef4216f71453e4d131ee9c40706b7ec20;hpb=87c3f2244a47ad10a031a27d0d0456f0a7defd21;p=distro-setup diff --git a/mail-setup b/mail-setup index cdbf9e8..616d39b 100755 --- a/mail-setup +++ b/mail-setup @@ -453,9 +453,17 @@ Pin-Priority: 500 EOF fi + +unit-exists() { + systemctl cat $1 &>/dev/null +} +spamd-timer-exists() { + unit-exists spamassassin-maintenance.timer +} + # name change in t12, and now timer instead of cron option in /etc/default first_spamd_run=false -if ! systemctl cat spamassassin-maintenance.timer &>/dev/null; then +if ! spamd-timer-exists; then first_spamd_run=true fi @@ -468,10 +476,14 @@ spamd_ser=spamd if systemctl cat spamassassin &>/dev/null; then spamd_ser=spamassassin elif $first_spamd_run; then - systemctl start spamassassin-maintenance + if spamd-timer-exists; then + systemctl start spamassassin-maintenance + fi fi -systemctl enable --now spamassassin-maintenance.timer +if spamd-timer-exists; then + systemctl enable --now spamassassin-maintenance.timer +fi # note: pyzor debian readme says you need to run some initialization command # but its outdated.