You are not logged in.
Pages: 1
I'm trying to set up systemd timer to work with Spamassassin on a VPS. According to https://wiki.archlinux.org/index.php/Po … amAssassin
But i got error when executing:
sudo systemctl start spamassassin-update.timer
Job for spamassassin-update.timer failed.
See "systemctl status spamassassin-update.timer" and "journalctl -xe" for details.
systemctl status spamassassin-update.timer shows:
Nov 06 21:15:43 uranus systemd[1]: spamassassin-update.timer: Refusing to start, unit to trigger not loaded.
Nov 06 21:15:43 uranus systemd[1]: Failed to start spamassassin house keeping.
journalctl -xe shows:
Nov 06 21:15:43 uranus sudo[10670]: uranususer_lap : TTY=pts/0 ; PWD=/home/uranususer_lap ; USER=root ; COMMAND=/usr/bin/systemctl start spamassassin-update.timer
Nov 06 21:15:43 uranus sudo[10670]: pam_unix(sudo:session): session opened for user root by uranususer_lap(uid=0)
Nov 06 21:15:43 uranus systemd[1]: spamassassin-update.timer: Refusing to start, unit to trigger not loaded.
Nov 06 21:15:43 uranus systemd[1]: Failed to start spamassassin house keeping.
-- Subject: Unit spamassassin-update.timer has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit spamassassin-update.timer has failed.
File spamassassin-update.timer (accordning to wiki)
# /etc/systemd/system/spamassassin-update.timer
[Unit]
Description=spamassassin house keeping
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
File spamassassin-update.service (accordning to wiki)
# /etc/systemd/system/spamassassin-update.service
[Unit]
Description=spamassassin housekeeping stuff
[Service]
#User=spamd
#Group=spamd
Type=oneshot
ExecStart=/usr/bin/vendor_perl/sa-update --allowplugins #You can remove the allowplugins options if you do not want direct plugin updates from SA.
SuccessExitStatus=0 1 #0 = updated, 1 = no updates available
ExecStart=/usr/bin/vendor_perl/sa-compile
SuccessExitStatus=0
# You can automatically train SA's bayes filter by uncommenting this line and specifying the path to a mailbox where you store email that is spam (for ex this could be yours or your users manually reported spam)
#ExecStart=/usr/bin/vendor_perl/sa-learn --spam <path to your spam>
File spamassassin.service (accordning to wiki)
# /etc/systemd/system/spamassassin.service
[Unit]
Description=Spamassassin daemon
After=syslog.target network.target
PartOf=spamassassin-update.service
[Service]
ExecStart=/usr/bin/vendor_perl/spamd -x -u spamd -g spamd
StandardOutput=null
StandardError=null
Restart=always
[Install]
WantedBy=multi-user.target
Suggestions are welcome.
Last edited by J.Martinsson (2017-11-08 14:24:28)
Offline
I am not sure that comments can be placed at the end of a line. 'man systemd.unit' says:
Empty lines and lines starting with "#" or ";" are ignored. This may be used for commenting.
Offline
Thank you for your input. I tried to do as you suggest, with comments in a new row. But it was no difference. Still same error.
It was actually a typo. The file which I typed it's name as spamassassin-update.service I had i reality named spamassassin-update-service. In this case it seems to be OK to have comments not only i beginning of a new row. (Even if i don have it any longer)
Thank you anyway.
Offline
After testing, I see that comments are also ignored when placed at the end of a line.
So the manual page is not fully clear about that.
Offline
Sorry to post again, but after more testing I am not so sure about my previous post above.
I wrote a service in $HOME/.config/systemd/user/bertest.service
[Unit]
Description=Testing Execstart launching
[Service]
ExecStart=/home/berbae/bin/bertest.sh # This is a comment
The script is
#!/bin/bash
echo "Message from bertest.sh script with $# parameters" > ~/tmp/bertest.log
The result after 'systemctl --user start bertest' is:
Message from bertest.sh script with 5 parameters
So the '# This is a comment' text was not ignored but taken as parameters to the script.
Offline
Good to know. Further on I will place comments in beginning of a row in systemd files.
Offline
I have updated the Arch Wiki - https://wiki.archlinux.org/index.php/Po … ule_update
It addresses following issues that existed in .service file.
1) Rules were compiled even if there was no rule update (now it does not compile unnecessarily)
2) Same way spamassassin was restarted even if there was no rule update (now it does not restart unnecessarily)
3) If rules were updated then restart spamassassin immediately (only if running) and not delay by 24 hours (or till next run of of the timer)
4) Avoid drop-in config. PartOf does not run on start but only on stop and restart. So if you stop the timer/rule-update, it will stop spamassassin too!! Which is obviously not what is desired.
Other issues not related to spamassassin
5) SuccessExitStatus=0 1 is same as SuccessExitStatus=1 (0 is always a success for systemd)
6) Two SuccessExitStatus make no sense as systemd will merge them into one anyway (effectively it becomes SuccessExitStatus=1)
7) Fixed trailing comments as they are not supported by systemd
Last edited by amish (2018-04-29 10:35:03)
Offline
Pages: 1