1

Topic: mail not working

==== 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:
====


Pull Iredmail down on July 11, 2015 for CentOS 6.6 clean.  Ran install for it per directions with option Nginx and SOGo selected.  Reboot as recommended upon completion of scripts.  All web interface panels come up initially.  However, cannot send e-mail from RoundCube.  Did not test others. 

Ran install for iRedAdmin-Pro per instructions: http://www.iredmail.org/docs/migrate.or … admin.html
upgrade.sh script.

Pro panels and other panels all up.  However, will not send e-mail.

Did note that iRedAPD is NOT running.  If start it by hand, it does send e-mail.   Reboot service is off and fails to send email.

chkconfig --list | grep iredapd
iredapd            0:off    1:off    2:off    3:on    4:on    5:on    6:off




less /etc/init.d/iredapd
----------------------------------------------------------------------------------------------
#!/usr/bin/env bash

# Author: Zhang Huangbin (zhb@iredmail.org)

### BEGIN INIT INFO
# chkconfig: - 99 99
# description: iredapd is a mail list access policy daemon.
# processname: iredapd
### END INIT INFO

PROG='iredapd'
BINPATH='/opt/iredapd/iredapd.py'
PIDFILE='/var/run/iredapd.pid'

check_status() {
    # Usage: check_status pid_number
    PID="${1}"
    l=$(ps -p ${PID} | wc -l | awk '{print $1}')
    if [ X"$l" == X"2" ]; then
        echo "running"
    else
        echo "stopped"
    fi
}

start() {
    if [ -f ${PIDFILE} ]; then
        PID="$(cat ${PIDFILE})"
        s="$(check_status ${PID})"

        if [ X"$s" == X"running" ]; then
            echo "${PROG} is already running."
        else
            rm -f ${PIDFILE} >/dev/null 2>&1
        fi
    fi

    echo "Starting ${PROG} ..."
    python ${BINPATH}
    unset s
}

stop() {
    if [ -f ${PIDFILE} ]; then
        PID="$(cat ${PIDFILE})"
        s="$(check_status ${PID})"

        if [ X"$s" == X"running" ]; then
            echo "Stopping ${PROG} ..."
            kill -9 ${PID}
            if [ X"$?" == X"0" ]; then
                rm -f ${PIDFILE} >/dev/null 2>&1
            else
                echo -e "\t\t[ FAILED ]"
            fi
        else
            echo "${PROG} is already stopped."
            rm -f ${PIDFILE} >/dev/null 2>&1
        fi
    else
        echo "${PROG} is already stopped."
    fi
    unset s
}

status() {
    if [ -f ${PIDFILE} ]; then
        PID="$(cat ${PIDFILE})"
        s="$(check_status ${PID})"

        if [ X"$s" == X"running" ]; then
            echo "${PROG} is running."
            exit 0
        else
            echo "${PROG} is stopped."
            exit 1
        fi
    else
        echo "${PROG} is stopped."
        exit 3
    fi
}

case "$1" in
    start) start ;;
    stop) stop ;;
    status) status ;;
    restart) stop && sleep 1 && start ;;
    *)
        echo $"Usage: $0 {start|stop|restart|status}"
        RETVAL=1
        ;;
esac

----------------------------------------------------------------------------------------------

----

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

2

Re: mail not working

FYI

ps aux | grep uwsgi
root      1940  0.0  0.0 108436  1816 ?        S    14:50   0:00 /bin/sh /etc/rc3.d/S85uwsgi start
root      1946  0.0  0.0 108168  1380 ?        S    14:50   0:00 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/sbin/uwsgi --ini /etc/uwsgi.ini
root      1947  0.0  0.0  57024  3256 ?        S    14:50   0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
root      1948  0.0  0.0  56572  1256 ?        S    14:50   0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
2001      1949  0.0  0.0 163404  6248 ?        S    14:50   0:00 /usr/sbin/uwsgi --ini iredadmin.ini
root      1950  0.0  0.0  57024  1008 ?        S    14:50   0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
root      1951  0.0  0.0  57024  1008 ?        S    14:50   0:00 /usr/sbin/uwsgi --ini /etc/uwsgi.ini
2001      1955  0.0  0.2 313560 18864 ?        S    14:50   0:02 /usr/sbin/uwsgi --ini iredadmin.ini
root      2174  0.0  0.0 103244   856 pts/1    S+   17:32   0:00 grep uwsgi

3

Re: mail not working

*) Do you have 'daemonize =' in /etc/uwsgi.ini?
*) Any error or warning message in system console? I mean the console which you can see the boot message, not a virtual terminal like gnome-terminal, xrxvt, etc.

4

Re: mail not working

ZhangHuangbin wrote:

*) Do you have 'daemonize =' in /etc/uwsgi.ini?
*)

[uwsgi]

File as installed below.......   

# try to autoload appropriate plugin if "unknown" option has been specified
autoload = true

# enable master process manager
master = true

# spawn 2 uWSGI worker processes
workers = 2

# automatically kill workers on master's death
no-orphans = true

# write master's pid in file
pidfile = /var/run/uwsgi.pid

# bind to UNIX socket file
socket = /var/run/uwsgi.socket

# set mode of created UNIX socket
chmod-socket = 660

# place timestamps into log
log-date = true

# user identifier of uWSGI processes
#uid = uwsgi

# group identifier of uWSGI processes
#gid = uwsgi

# multi-app deployment
emperor = /etc/uwsgi.d
emperor-tyrant = false





ZhangHuangbin wrote:

Any error or warning message in system console? I mean the console which you can see the boot message, not a virtual terminal like gnome-terminal, xrxvt, etc.

It is a virtual machine so I can configure a console for boot if required to see it as starts up.  Otherwise, would it be logged into /var/log/messages like these entries?

cat /var/log/messages | grep -i "uwsgi"
Jul 12 13:58:44 mail02 yum[1944]: Installed: uwsgi-2.0.9-7.el6.x86_64
Jul 12 13:58:45 mail02 yum[1944]: Installed: uwsgi-plugin-common-2.0.9-7.el6.x86_64
Jul 12 13:59:06 mail02 yum[1944]: Installed: uwsgi-plugin-python-2.0.9-7.el6.x86_64

If not, have you taken out all uwsgi logging at /var/log/uwsgi/uwsgi.log?

5

Re: mail not working

So do you want this line in the file:

# Run in background and log to file
daemonize = /var/log/uwsgi/uwsgi.log


Adding such results in the iredapd service starting now with reboot.  However, the 502 Bad Gateway Nginx error returns with no access to iredadmin. 

2015/07/13 17:29:52 [crit] 1857#0: *4 connect() to unix:/var/run/uwsgi_iredadmin.socket failed (2: No such file or directory) while connecting to upstream, client: x.x.x.x, server: _, request: "GET /iredadmin HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi_iredadmin.socket:", host: "host.domain_name.tld"


So did these steps:
mkdir /var/log/uwsgi/
touch /var/log/uwsgi/uwsgi.log
chmod 0640 /var/log/uwsgi/uwsgi.log

as per this thread again:
http://www.iredmail.org/forum/topic9486 … -send.html


Reboot - iRedAdmin-Pro is accessible and can login. 

Nobody has answered the question as to the appropriate permissions for this directory and log file.

6

Re: mail not working

I found this issue days ago, here's why it occurs:

*) Without 'daemonize =' line in /etc/uwsgi.ini, uwsgi service will hang the system boot process and don't run in background, this causes all services which are scheduled (by SysV init scripts) to be started after uwsgi service will not start. including iRedAPD.

*) With 'daemonize =' line in /etc/uwsgi.ini (with a proper log file path), all services are working.