1

Topic: Script emails since 0.9.5 upgrade

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

Three issues after upgrading to 0.9.5 and iRedAdmin-Pro 2.4.0:

1. As admin for this system, I receive email every 10 minutes about the spf_to_greylist_whitelists.py script like this:

* Query SQL server to get mail domain names.
* Parsing domains, 36 in total.
    + [amazon.com]
    + [aol.com]
..

I think I can fix this by adding '2>&1' to the end of this new cron job. Any problem with doing so?

2. As admin for this system, I receive email every hour about the cleanup_db.py script with these errors:

/usr/local/www/iredadmin/tools/cleanup_db.py: import: not found
/usr/local/www/iredadmin/tools/cleanup_db.py: import: not found
/usr/local/www/iredadmin/tools/cleanup_db.py: import: not found
/usr/local/www/iredadmin/tools/cleanup_db.py: os.environ[LC_ALL]: not found
/usr/local/www/iredadmin/tools/cleanup_db.py: 31: Syntax error: "(" unexpected

How to correct these errors?

3. After running the iRedAdmin-Pro upgrade script, the system complained that it could not restart apache22 even though apache24 is the only Apache port installed on the system. Manually restarting Apache with '/usr/local/etc/rc.d/apache24 restart' worked OK.

Thanks for your guidance on these.

----

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

2

Re: Script emails since 0.9.5 upgrade

About #1 and #2, please show us output of command:

crontab -l -u root

About #3, seems a bug in iRedAdmin-Pro upgrade script, i will check it and come back to you later.

Thanks for the feedback. smile

3

Re: Script emails since 0.9.5 upgrade

cvcvelo wrote:

3. After running the iRedAdmin-Pro upgrade script, the system complained that it could not restart apache22 even though apache24 is the only Apache port installed on the system. Manually restarting Apache with '/usr/local/etc/rc.d/apache24 restart' worked OK.

Could you please show me output of command below?

ls -l /usr/local/etc/rc.d/a*

4 (edited by cvcvelo 2016-05-05 00:29:28)

Re: Script emails since 0.9.5 upgrade

Here is the output of 'crontab -l -u root':

# iRedMail: Cleanup Cluebringer database
# 1   3   *   *   *   /usr/local/bin/cbpadmin --config=/usr/local/etc/cluebringer.conf --cleanup >/dev/null 2>&1

# iRedMail: Cleanup Amavisd database
1   2   *   *   *   /usr/local/bin/python /usr/local/www/iredadmin/tools/cleanup_amavisd_db.py >/dev/null 2>&1

# iRedMail: update Awstats statistics for web
1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=web -update >/dev/null 2>&1

# iRedMail: update Awstats statistics for smtp
1   */1   *   *   *   perl /usr/local/www/awstats/cgi-bin/awstats.pl -config=smtp -update >/dev/null 2>&1

# Cleanup Roundcube SQL database.
2   2   *   *   *   php /usr/local/www/roundcube/bin/cleandb.sh >/dev/null 2>&1

# iRedMail: Backup MySQL databases (at 03:30AM)
30   3   *   *   *   /usr/local/bin/bash /var/vmail/backup/backup_mysql.sh >/dev/null 2>&1

# iRedAPD: Clean up expired tracking records hourly.
1   *   *   *   *   /usr/local/bin/python /opt/iredapd/tools/cleanup_db.py >/dev/null 2>&1
# iRedAPD: Convert specified SPF DNS record of specified domain names to IP
#          addresses/networks every 10 minutes.
*/10   *   *   *   *   /usr/local/bin/python /opt/iredapd/tools/spf_to_greylist_whitelists.py >/dev/null 2>&1
# iRedAPD: Convert specified SPF DNS record of specified domain names to IP
#          addresses/networks every 10 minutes.
*/10   *   *   *   *   /usr/local/bin/python /opt/iredapd/tools/spf_to_greylist_whitelists.py >/dev/null 2>&1
# iRedAPD: Convert specified SPF DNS record of specified domain names to IP
#          addresses/networks every 10 minutes.
*/10   *   *   *   *   /usr/local/bin/python /opt/iredapd/tools/spf_to_greylist_whitelists.py >/dev/null 2>&1

# Let's Encrypt recert
#minute hour    mday    month   wday    command
1    4    1    *    *    /etc/ssl/priv/recert.sh

# iRedAPD: Convert specified SPF DNS record of specified domain names to IP
#          addresses/networks every 10 minutes.
*/10   *   *   *   *   /usr/local/bin/python /opt/iredapd/tools/spf_to_greylist_whitelists.py >/dev/null 2>&1
# iRedAdmin: Clean up sql database.
1   *   *   *   *    /usr/local/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1


The Let's Encrypt script is something I added to automate certificate creation.

For the last two scripts -- both added by this upgrade -- note that I have changed '&>/dev/null' to '>/dev/null 2>&1' because this is how FreeBSD root account silently handles cron jobs (with its default tcsh shell).

5

Re: Script emails since 0.9.5 upgrade

Here is the output of 'ls -l /usr/local/etc/rc.d/a*':

-r-xr-xr-x  1 root  wheel  1086 Oct 15  2015 /usr/local/etc/rc.d/amavis-p0fanalyzer
-r-xr-xr-x  1 root  wheel  1354 Oct 15  2015 /usr/local/etc/rc.d/amavisd
-r-xr-xr-x  1 root  wheel   786 Oct 15  2015 /usr/local/etc/rc.d/amavisd-snmp
-r-xr-xr-x  1 root  wheel  6219 May  1 18:25 /usr/local/etc/rc.d/apache24

6

Re: Script emails since 0.9.5 upgrade

If you check file 'tools/upgrade_iredadmin.sh' shipped in iRedAdmin-Pro, it detects /usr/local/etc/rc.d/apache24 first:

elif [ X"${KERNEL_NAME}" == X'FREEBSD' ]; then
    export DISTRO='FREEBSD'
    export HTTPD_SERVERROOT='/usr/local/www'
    if [ -f /usr/local/etc/rc.d/apache24 ]; then
        export HTTPD_RC_SCRIPT_NAME='apache24'
    else:
        export HTTPD_RC_SCRIPT_NAME='apache22'
    fi
    ...

I'm confused.

7

Re: Script emails since 0.9.5 upgrade

cvcvelo wrote:

# iRedAdmin: Clean up sql database.
1   *   *   *   *    /usr/local/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1

You should specify the python program:

1   *   *   *   *    /usr/local/bin/python /usr/local/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1

8

Re: Script emails since 0.9.5 upgrade

ZhangHuangbin wrote:
cvcvelo wrote:

# iRedAdmin: Clean up sql database.
1   *   *   *   *    /usr/local/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1

You should specify the python program:

1   *   *   *   *    /usr/local/bin/python /usr/local/www/iredadmin/tools/cleanup_db.py >/dev/null 2>&1

Thanks. That fixed the problem with the cleanup_db.py script. I think that, at least for the FreeBSD version, python should be included in the cronjob. (This line was added by the most recent upgrade.)

As for the system complaining about apache22, I too am confused. I saw that the upgrade script checks first for apache24, so there should not have been an apache22 error. It's no big deal; the system appears to be working OK now.

Thanks!

9

Re: Script emails since 0.9.5 upgrade

cvcvelo wrote:

I think that, at least for the FreeBSD version, python should be included in the cronjob. (This line was added by the most recent upgrade.)

I checked file "tools/upgrade_iredapd.sh", python path is supposed to be added in cron job. Not sure why it doesn't work for you.