Issue
I will preface this by saying I am very new to command line programming with Debian Ubuntu...
I have been trying to set up a crontab list on a Debian Ubuntu server but have not been able to get it to work. Here is a sample:
[email protected]
* * * * * wall test
* * * * * /usr/bin/python2.6 /home/user/test.py > /home/user/clean_tmp_dir.log
The above shows up when I type "crontab -l" but no resulting output appears in the console. The "test.py" is supposed to generate a csv file but none is being created.
I am not receiving any output/error emails. I tried to find a log, but "var/log/cron" does not exist, nor does "etc/syslog.conf"...I tried to edit "etc/rsyslog.conf", but got "E212: Can't open file for writing"...I am logged in, however. Do I need some sort of special administrative privileges? Do I need to specify user or "root" or something?
Does anyone know what I'm doing wrong, how I can create/view a log, or how I can perform any other straightforward tests? Thanks!
Solution
Ok, let's start over again.
Create a file, say cron.txt
, with exactly the following contents (1 line):
* * * * * touch $HOME/CRON_IS_RUNNING
(Do not create CRON_IS_RUNNING manually.) Run
crontab cron.txt
which should quietly produce no output, then
crontab -l
which should print
* * * * * touch $HOME/CRON_IS_RUNNING
Wait a minute or so, perhaps 2 minutes, then
ls -l $HOME/CRON_IS_RUNNING
which should print something like
-rw-r--r-- 1 yourname yourgroup 0 2011-08-23 20:11 CRON_IS_RUNNING
If this all works, it will confirm that you can run cron jobs.
If that's successful, the problem may be with your test.py
command. Does it work when you run it from the command line? If it works from the command line but not from cron
, test.py
might have some dependency on environment variables (cron jobs run with fewer environment variables set than interactive commands typically do).
Answered By - Keith Thompson