1

Topic: Crashing - how to check services?

==== Required information ====
- iRedMail version (check /etc/iredmail-release):
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- Related log if you're reporting an issue:
======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Linux/BSD distribution name and version:  Debian 8.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Hi,

For some reason, every now and then, the email stuff stops working. After a while, we worked out:

After digging around I noted that it was a problem with iredapd - this is a custom python script that iredmail uses and open port 7777 to pass messages back and forth for what looks like 'sanitation'. Once restarted it seems to run well.. My only wonder is why this script randomly stops running??

We may need to introduce a simple bash script or if you want create a perl script, that checks that the service is up and port 7777 is open. If not it forces it restart. This is the unfortunate issue when a third party mail service decides to write 'clever' little scripts/services for, what should be a fairly simple mail server configuration hmm

So, my question is:

1) Any ideas why it would crash?
2) How could we auto-check it via a cron, and then restart if needed?

service iredapd restart

I guess doing that would fix it - but how would I check if its running? At the moment, I have a little script that I use  to check tomcat/nginx/mssql:

#!/bin/bash

declare -a arr=(tomcat7 nginx mysql);

for i in "${arr[@]}"
do
   echo "Checking $i"
    if (( $(ps -ef | grep -v grep | grep $i | wc -l) > 0 ))
    then
    echo "$i is running!!!"
    else
    echo "service $i start\n"
    service $i start
    fi
done

# re-run, but this time do a restart if its still not going!
for i in "${arr[@]}"
do
   echo "Checking $i"
    if (( $(ps -ef | grep -v grep | grep $i | wc -l) > 0 ))
    then
    echo "$i is running!!!"
    else
    service $i restart
    fi
done

Could I add something to that, which would lookup if iRedMail is running ok, and then restart if needed?

Cheers

Andy

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Crashing - how to check services?

Please upgrade to iRedMail-0.9.3, it ships a new version of iRedAPD (1.7.0) which fixes this issue.

This issue was caused by weekly log rotate, iRedAPD didn't work well after log rotated. In new release (1.7.0), we don't rely on 'logrotate' program to rotate its log file, so it goes well.

If you don't want to upgrade iRedMail to 0.9.3 right now, it's ok to just upgrade iRedAPD to 1.7.0 by following the tutorial below:
http://www.iredmail.org/docs/upgrade.iredapd.html

Note: If you're running Cluebringer, you should migrate from Cluebringer to iRedAPD by following tutorial below:
http://www.iredmail.org/docs/cluebringe … edapd.html

3

Re: Crashing - how to check services?

ZhangHuangbin wrote:

Please upgrade to iRedMail-0.9.3, it ships a new version of iRedAPD (1.7.0) which fixes this issue.

This issue was caused by weekly log rotate, iRedAPD didn't work well after log rotated. In new release (1.7.0), we don't rely on 'logrotate' program to rotate its log file, so it goes well.

If you don't want to upgrade iRedMail to 0.9.3 right now, it's ok to just upgrade iRedAPD to 1.7.0 by following the tutorial below:
http://www.iredmail.org/docs/upgrade.iredapd.html

Note: If you're running Cluebringer, you should migrate from Cluebringer to iRedAPD by following tutorial below:
http://www.iredmail.org/docs/cluebringe … edapd.html

Thanks - I've done the upgrade, and will see if it occurs again smile

4

Re: Crashing - how to check services?

Don't forget to apply this hotfix if you upgraded from iRedMail-0.9.2:
http://www.iredmail.org/forum/topic1034 … -file.html