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
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.