Testing Crontab on Debian Ubuntu

I will precede this by saying that I am very new to command line programming with Debian Ubuntu ...

I am trying to set up a crontab list on a Debian Ubuntu server, but could not get it to work. Here is an example:

MAILTO=myemail@gmail.com
* * * * * wall test
* * * * * /usr/bin/python2.6 /home/user/test.py > /home/user/clean_tmp_dir.log

Above, when I type “crontab -l”, but the final result does not appear in the console. It is assumed that "test.py" creates the csv file, but not one of them is created.

I do not receive any exit / error messages. I tried to find the log, but "var / log / cron" does not exist, as well as "etc / syslog.conf" ... I tried to edit "etc / rsyslog.conf", but got "E212: Can", t open the file for the record "... However, I logged in. Do I need any special administrative privileges? Do I need to specify a user or" root "or something else?

Does anyone know what I'm doing wrong, how can I create / view a log, or how can I perform any other simple tests? Thank!

+5
source share
2 answers

Ok, start over.

Create a file, say cron.txt, with exactly the following contents (1 line):

* * * * * touch $HOME/CRON_IS_RUNNING

( CRON_IS_RUNNING .)

crontab cron.txt

,

crontab -l

* * * * * touch $HOME/CRON_IS_RUNNING

, , 2 ,

ls -l $HOME/CRON_IS_RUNNING

-

-rw-r--r-- 1 yourname yourgroup 0 2011-08-23 20:11 CRON_IS_RUNNING

, , cron.

, test.py. , ? , cron, test.py ( cron , ).

+29

. : echo test | wall. wall test test.

cron /var/log/syslog

cronjob /var/spool/cron/crontabs/username,

:

"Debian Squeeze", crontab root.

test.py :

#!/usr/bin/python
print "hello"

:

this is a test

crontab -e crontab:

MAILTO=myemail@gmail.com
* * * * * wall /usr/local/src/test
* * * * * /usr/bin/python2.6 /usr/local/src/test.py > /usr/local/src/test.log

, :

Broadcast Message from root@X-Wing                                             
        (somewhere) at 21:09 ...                                               

This is a test   

test.log :

hello

/var/log/syslog:

Aug 23 21:08:49 x-wing crontab[9850]: (root) REPLACE (root)
Aug 23 21:08:49 x-wing crontab[9850]: (root) END EDIT (root)
Aug 23 21:09:01 x-wing /usr/sbin/cron[1615]: (root) RELOAD (crontabs/root)
Aug 23 21:09:02 x-wing /USR/SBIN/CRON[9860]: (root) CMD (/usr/bin/python2.6 /usr/local/src/test.py > /usr/local/src/test.log)
Aug 23 21:09:02 x-wing /USR/SBIN/CRON[9862]: (root) CMD (wall /usr/local/src/test)
+1

All Articles