Why is scheduler creating so many files at /var/spool/postfix/maildrop?

587 views
Skip to first unread message

Lisandro

unread,
Aug 9, 2018, 6:56:33 PM8/9/18
to web2py-users
I've found that my production server has a lot of files in /var/spool/postfix/maildrop. 
I don't use postfix at all, however that folder is full of files. 
All the files follow the same name format, like this: 2B8431690D, 5712AE68F, 73CF062660, 73C02183A9, 5706512838, 2B7E413705.

The file content appears to be encoded, but using nano I can see they all have something very similar, like this:

T^Q1533305867 356761A^Urewrite_context=localF
CronDaemonS^EnginxM^@N^]From: "(Cron Daemon)" <nginx>N  To: nginxN]Subject: Cron <nginx@medios> python /var/www/medios/web2py.py -K webmedios # web2py schedulerN'Content-Type: text/plain; charset=UTF-8N^^Auto-Submitted: auto-generatedN^PPrecedence: bulkN#X-Cron-Env: <XDG_SESSION_ID=112002>N+X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/998>N^]X-Cron-Env: <LANG=es_AR.utf8>N^[X-Cron-Env: <SHELL=/bin/sh>N!X-Cron-Env: <HOME=/var/lib/nginx>N X-Cron-Env: <PATH=/usr/bin:/bin>N^[X-Cron-Env: <LOGNAME=nginx>N^XX-Cron-Env: <USER=nginx>N^@N^Tweb2py Web FrameworkN1Created by Massimo Di Pierro, Copyright 2007-2018N3Version 2.16.1-stable+timestamp.2017.11.14.05.54.25NGDatabase drivers available: sqlite3, psycopg2, pg8000, pymysql, imaplibN,starting single-scheduler for "webmedios"...X^@R^EnginxE^@


Notice this line:
python /var/www/medios/web2py.py -K webmedios


I'm using the system's cron (with the "nginx" user) to run the scheduler, so I guess these files are being created each time the scheduler is run. 
Is there a way to avoid those files being created? Or is it something I would have to solve at OS level?

Thanks in advance!

Dave S

unread,
Aug 10, 2018, 6:52:30 PM8/10/18
to web2py-users

It looks like it has nothing to do with the scheduler and everything to do with the cron daemon.
Notice this line:
From: "(Cron Daemon)"


How often are they being created?  The scheduler generally only needs to be started once per boot.

/dps
 

Lisandro

unread,
Aug 13, 2018, 8:43:13 AM8/13/18
to web2py-users
Thanks for that clarification.
The files were being created every minute, in concordance with the frequence I run the scheduler.
I was able to solve it adding ">/dev/null 2>&1" to the end of the line in crontab, so it ended up like this:

* * * * * python /var/www/medios/web2py.py -K webmedios >/dev/null 2>&1

That did the trick, and those files are not created anymore.
Thank you for your help!

Best regards,
Lisandro.

Dave S

unread,
Aug 13, 2018, 3:18:57 PM8/13/18
to web2py-users


On Monday, August 13, 2018 at 5:43:13 AM UTC-7, Lisandro wrote:
Thanks for that clarification.
The files were being created every minute, in concordance with the frequence I run the scheduler.
I was able to solve it adding ">/dev/null 2>&1" to the end of the line in crontab, so it ended up like this:

* * * * * python /var/www/medios/web2py.py -K webmedios >/dev/null 2>&1

That did the trick, and those files are not created anymore.
Thank you for your help!

Best regards,
Lisandro.

I don't understand why you are starting the scheduler every minute, instead of starting it once, and then scheduling tasks to repeat on a 1 minute schedule.

/dps
 

Lisandro

unread,
Aug 13, 2018, 5:44:59 PM8/13/18
to web2py-users
To be honest, that's the way I do it since long time ago, never thought about changing it. But now that you've pointed that out, I've taken another look to the book.
The book explains how to run the scheduler via upstart [1], but I'm using CentOS 7, which uses systemd instead of upstart.

In case it helps someone else, here is what I did to run the scheduler via systemd:


1) I've created the file /home/myuser/web2py/scheduler.sh with this content:

#!/bin/bash
/bin/python /home/myuser/web2py/web2py.py -K myapp


2) Then I've created the file /etc/systemd/system/scheduler.service with this content:

[Unit]
 
Description=web2py Scheduler

[Service]
 
ExecStart=/home/myuser/web2py/scheduler.sh
 
User=nginx

[Install]
 
WantedBy=default.target


3) Then run this commands to start the service:
sudo systemctl daemon-reload
sudo systemctl start scheduler

If you need to check the status of the service, run:
sudo systemctl status scheduler

If you need to enable the service to run on startup, run:
sudo systemctl enable scheduler


Thank you very much Dave for your time!
Best regards,
Lisandro.

Dave S

unread,
Feb 5, 2019, 5:31:43 PM2/5/19
to web...@googlegroups.com


On Monday, August 13, 2018 at 2:44:59 PM UTC-7, Lisandro wrote:
To be honest, that's the way I do it since long time ago, never thought about changing it. But now that you've pointed that out, I've taken another look to the book.
The book explains how to run the scheduler via upstart [1], but I'm using CentOS 7, which uses systemd instead of upstart.


And I'm going to thank you for the systemd crib sheet, which I can use on some of my internal systems.

Dave S
/dps

Reply all
Reply to author
Forward
0 new messages