view · edit · sidebar · attach · print · history

20120605-debug-cron-job

<< | Index | >>


Summary

  • debuged import_daily job via crontab in production server.
    • I found problems in job via crontab about STDERR.

Index


locale of crontab

  • $ locale
  • checked LANG and LC_TYPE output via cron
local
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=POSIX
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES=en_US.UTF-8
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
production server(crontab, apache user)
# test
* * * * * apache locale > /tmp/cron-locale-test.txt

in @/hmp/cron-locale-test.txt@

LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

I added LANG and LC_TYPE variable into /etc/crontab.

Refs.


STDERR output limit of crontab

Next I checked STDOUT of import_daily via crontab in production server.

in /etc/crontab

LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
...
58 3 * * *       apache  /var/www/oddb.org/jobs/import_daily > /tmp/cron-import_daily.log

/var/log/crond/current

Jun  5 03:58:01 src@thinpower cron[10002]: (apache) CMD (/var/www/oddb.org/jobs/import_daily > /tmp/cron-import_daily.log)

But cron job halt.

And I updated about STDERR.
like this.

35 4 * * *       apache  /var/www/oddb.org/jobs/import_daily 1>/tmp/cron-import_daily.log 2>/tmp/cron-import_daily_error.log

Then import_daily job has worked fine !
STDERR(/tmp/cron-import_daily_error.log) was so huge file.

Attach:stderr-part-20120605.txt

I found a post about STDERR limit of crontab.

Refs.

We have to discard STDERR or redirect this output to anywere.
Finaly, I updated /etc/crontab like this.

1 9 * * *       apache  /var/www/oddb.org/jobs/import_daily >/dev/null 2>&1
view · edit · sidebar · attach · print · history
Page last modified on June 05, 2012, at 10:17 AM