zEitEr
Super Moderator
Hello,
The sa-update makes even more issues on CentOS 7:
1. Manually kill all process of spamd
2. Clean start with
check:
3. Run sa-update script.
with set -x we can see the following:
4. Check running spamd processes:
Note now we have a process with PID 4671, which is spamming /var/log/messages with the following errors:
until we kill manually process with PID 4665.
Now we have:
On CentOS 7 if we kill spamd process with:
A new instance of spamd will be started with children without need to manually start it.
Example:
So a possible solution would be to detect CentOS 7 and/or check whether or not another instance was started before executing:
The sa-update makes even more issues on CentOS 7:
1. Manually kill all process of spamd
2. Clean start with
Code:
systemctl start spamassassin
Code:
ps aux | grep spam
root 4637 47.5 1.6 287164 62588 ? Ss 10:17 0:01 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4640 0.0 1.5 287164 59840 ? S 10:17 0:00 spamd child
root 4641 0.0 1.5 287164 59840 ? S 10:17 0:00 spamd child
root 4643 0.0 0.0 112668 960 pts/2 S+ 10:17 0:00 grep --color=auto spam
3. Run sa-update script.
Code:
/etc/cron.daily/sa-update
with set -x we can see the following:
Code:
+ LOG=/var/log/sa-update.log
+ PID=/var/run/spamd.pid
+ '[' -s /var/log/sa-update.log ']'
+ '[' -e /var/log/sa-update.log.2 ']'
+ rm -f /var/log/sa-update.log.2
+ '[' -e /var/log/sa-update.log.1 ']'
+ mv -f /var/log/sa-update.log.1 /var/log/sa-update.log.2
+ mv -f /var/log/sa-update.log /var/log/sa-update.log.1
+ /usr/bin/sa-update -D --nogpg
+ RET=1
+ '[' 1 -ge 4 ']'
+ '[' -s /var/run/spamd.pid ']'
++ cat /var/run/spamd.pid
+ ps -p 4637
+ '[' 0 -eq 0 ']'
++ cat /var/run/spamd.pid
+ kill -9 4637
+ /usr/bin/spamd -d -c -m 15 --ipv4 --pidfile=/var/run/spamd.pid
+ '[' 1 -eq 1 ']'
+ RET=0
+ exit 0
4. Check running spamd processes:
Code:
ps aux | grep spam
root 4665 10.8 1.6 287452 62704 ? Ss 10:18 0:01 /usr/bin/spamd -d -c -m 15 --ipv4 --pidfile=/var/run/spamd.pid
root 4667 0.0 1.5 287452 59740 ? S 10:18 0:00 spamd child
root 4668 0.0 1.5 287452 59740 ? S 10:18 0:00 spamd child
root 4671 4.0 0.6 206788 25448 ? Ss 10:18 0:00 /usr/bin/perl -T -w /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4674 0.0 0.0 112668 960 pts/2 S+ 10:18 0:00 grep --color=auto spam
Note now we have a process with PID 4671, which is spamming /var/log/messages with the following errors:
Code:
Apr 6 10:14:29 centos7 spamd: server socket setup failed, retry 1: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:30 centos7 spamd: server socket setup failed, retry 2: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:31 centos7 spamd: server socket setup failed, retry 3: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:32 centos7 spamd: server socket setup failed, retry 4: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:33 centos7 spamd: server socket setup failed, retry 5: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:34 centos7 spamd: server socket setup failed, retry 6: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:35 centos7 spamd: server socket setup failed, retry 7: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
Apr 6 10:14:36 centos7 spamd: server socket setup failed, retry 8: spamd: could not create IO::Socket::IP socket on [127.0.0.1]:783: Address already in use
until we kill manually process with PID 4665.
Code:
kill -9 4665 4667 4668
Now we have:
Code:
ps aux | grep spam
root 4829 63.6 1.6 287152 62568 ? Ss 10:21 0:01 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4830 0.0 1.5 287152 59824 ? S 10:21 0:00 spamd child
root 4831 0.0 1.5 287152 59816 ? S 10:21 0:00 spamd child
root 4833 0.0 0.0 112668 956 pts/2 S+ 10:21 0:00 grep --color=auto spam
On CentOS 7 if we kill spamd process with:
Code:
kill -9 `cat /var/run/spamd.pid`
A new instance of spamd will be started with children without need to manually start it.
Example:
Code:
root@centos7:> kill -9 `cat /var/run/spamd.pid`
root@centos7:>
root@centos7:> ps aux | grep spamd
root 4877 19.0 0.6 207448 26096 ? Ss 10:23 0:00 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4879 124 0.9 227652 36832 ? Rs 10:23 0:01 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4906 0.0 0.0 112668 956 pts/2 R+ 10:23 0:00 grep --color=auto spamd
root@centos7:>
root@centos7:> ps aux | grep spamd
root 4879 50.5 1.6 287152 62572 ? Ss 10:23 0:02 /usr/bin/spamd --pidfile /var/run/spamd.pid -d -c -m 15 --ipv4
root 4909 0.0 1.5 287152 59820 ? S 10:23 0:00 spamd child
root 4910 0.0 1.5 287152 59832 ? S 10:23 0:00 spamd child
root 4912 0.0 0.0 112668 960 pts/2 S+ 10:23 0:00 grep --color=auto spamd
So a possible solution would be to detect CentOS 7 and/or check whether or not another instance was started before executing:
Code:
/usr/bin/spamd -d -c -m 15 --ipv4 --pidfile=/var/run/spamd.pid