2

might be somewhat of a boring topic, but I was at it whole last night, cant seem to get it up and running.

root@host:~# /etc/init.d/cron status
Checking periodic command scheduler...done (running).

So the service seems to be running fine.

I have tried number of simple test cron jobs, but non of them worked:

* * * * * echo "Hello world !!!" 2&>1 >> /tmp/lol.log
05 06 * * mon-fri echo "Nightly Backup Successful: $(date)" >> /tmp/test.log

as well as that, one of the programers gave me this job, that i know is perfectly working on our current production server:

* * * * * wget -q -O /dev/null http://www.hostname.com/test/email_au

So in the end, non of them seem to be working, I have been going throught a number of guides on the web, but non of them seem to help. What could be missing ?

EDIT: The only cron related files in etc are: cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly, crontab. There is no cron.deny nor cron.allow files there. Also I am trying to run those cron jobs as root.

1
  • have you checked your /etc/security/time.conf if you have placed any schedule and also have you altered your /etc/pam.d/cron Apr 14, 2017 at 11:34

3 Answers 3

1

Have you checked cron logs as to what actually happened ?

Usually cron logs are disabled in debian system, enable this in your rsyslogd or syslogd by uncommenting cron log lines in respective configuration file.

cron.*              /var/log/cron.log
3
  • By default cron logs go to /var/log/syslog, grep for CRON string
    – kupson
    Feb 15, 2012 at 10:02
  • so do you see any cron logs or not ?
    – kaji
    Feb 15, 2012 at 12:02
  • 1
    I did turn logs on, and saw them, there wasn't much to see. I have done some tests and in the end it turns out that for some reason cron does not react to the current time zone. I have changed the time zone with tzselect on debian and when I do the date , it shows correct date. But cron, for some reason, works according to the old time zone. Any1 knows where does the cron look for a time zone ?
    – Katafalkas
    Feb 17, 2012 at 10:11
1

Check if you have files /etc/cron.allow or /etc/cron.deny. Users (but not root) can be restricted from running cron jobs.

From man 1 crontab:

If  the  /etc/cron.allow  file exists, then you must be listed
(one user per line) therein in order to be allowed to use this
command. If the /etc/cron.allow file does not exist but the
/etc/cron.deny file does exist, then you must not be listed in
the /etc/cron.deny file in order to use this command.
2
  • The only cron related files/directories in /etc/ are: cron.d, cron.daily, cron.hourly, cron.monthly, cron.weekly, crontab. As well as that I am running those as a root, trying to set a backup.
    – Katafalkas
    Feb 15, 2012 at 11:22
  • Then there is another reason.
    – kupson
    Feb 15, 2012 at 11:36
1

What do your cron files look like? I know from some experience there is a bug with some versions of Cron, in that cron will ignore last line of a cron file (meaning your command may just be being ignored since it may be on the last line of the file). Mayhap this might be the issue?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .