As you mentioned, nothing changes ,
First you must redirect both stdin and stderr from crontab execution, as shown below:
*/2 * * * * /usr/bin/python /home/souza/Documets/Listener/listener.py > /tmp/listener.log 2>&1
then you can look at the /tmp/listener.log file to see if the script is executing as you expect.
Secondly, suppose you mean to change something by observing the files created by your program:
f = file('counter', 'r+w') json_file = file('json_file_create_server.json','r+w')
the crontab work above will not create these files in the /home/souza/Documets/Listener , since the cron job is not running in this directory, and you are using the relative path in the program. So, to create this file in the /home/souza/Documets/Listener , the following cron job will do the trick:
*/2 * * * * cd /home/souza/Documets/Listener && /usr/bin/python listener.py > /tmp/listener.log 2>&1
Change the working directory and execute the script, then you can view the created files.
greenqy Jan 12 '16 at 3:33 2016-01-12 03:33
source share