I use the script for spamd.cfg and inotify-spamlearn.cfg
#!/bin/bash
SA_LEARN=$(type -p sa-learn)
if [ ! -f /var/lib/amavis/.spamassassin/bayes_toks ]; then
touch /var/lib/amavis/.spamassassin/bayes_toks
chown amavis:amavis /var/lib/amavis/.spamassassin/bayes_toks
chmod 600 /var/lib/amavis/.spamassassin/bayes_toks
fi
# learing from spam folder Spam
# learing from ham folder Ham
dospam(){
echo -n "spam:" |tee -a /tmp/jnspam.log
find /var/lib/kopano/spamd/spam \
-exec sudo -u amavis $SA_LEARN --dbpath /var/lib/amavis/.spamassassin --spam {} \; |tee -a /tmp/jnspam.log
}
doham(){
echo -n " ham:" |tee -a /tmp/jnspam.log
find /var/lib/kopano/spamd/ham \
-exec sudo -u amavis $SA_LEARN --dbpath /var/lib/amavis/.spamassassin --ham {} \; |tee -a /tmp/jnspam.log
}
case $1 in
spam|s)
dospam
;;
ham|h)
doham
;;
*)
echo "you can also start with parameters [spam|ham]"
dospam
doham
;;
esac
but nothing is written to my tmp log. At this point i am wondering about log information in /var/log/kopano/spamd.log because the logging in /etc/kopano/spamd.cfg was disabled. I had change now the log level to 6 and enabled logging. After restart the service i see this:
2018-10-25 15:54:54,943 - spamd - INFO - cannot open config file %s running with defaults 2018-10-25 15:54:54,943 - spamd - INFO - starting spamd
and after a while
2018-10-25 15:55:05,008 - spamd - ERROR - Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/kopano/log.py", line 89, in log_exc try: yield File "/usr/lib/python2.7/dist-packages/kopano/service.py", line 181, in start _daemonize(self.main, options=self.options, log=self.log, config=self.config, service=self) File "/usr/lib/python2.7/dist-packages/kopano/service.py", line 112, in _daemonize stderr=sys.stderr, File "/usr/lib/python2.7/dist-packages/kopano/daemon/daemon.py", line 352, in __enter__ self.open() File "/usr/lib/python2.7/dist-packages/kopano/daemon/daemon.py", line 344, in open self.pidfile.__enter__() File "/usr/lib/python2.7/dist-packages/kopano/lockfile.py", line 228, in __enter__ self.acquire() File "/usr/lib/python2.7/dist-packages/kopano/daemon/pidlockfile.py", line 109, in acquire super(TimeoutPIDLockFile, self).acquire(timeout, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/kopano/daemon/pidlockfile.py", line 59, in acquire super(PIDLockFile, self).acquire(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/kopano/lockfile.py", line 266, in acquire raise LockTimeout LockTimeout
What ist with the first Part “cannot open config file %s” and with the second one, after a spam, mail arrives the system?
And second: kopano-spamd has a “learncmdspam” and “learncmdham” option. So for what do i need “inotify-spamlearn” like described in https://documentation.kopano.io/kopanocore_administrator_manual/special_kc_configurations.html#configuring-kopano-spamd-for-automatic-spam-ham-learning
Jan