Running python app with cron



  • Hi all!

    Newbie question! :)

    I'm try to running every minute a simple python app with cron: the code works it is a simple hello world example :)
    /etc# python greeting.py
    hello finally!

    This is the crontab : * * * * * python /etc/greeting.py

    Then I restarted cron with /etc/init.d/cron restart but nothing happens...can understand what am I doing wrong :(

    Thanks all



  • Add

    $HOME/greeting.log 2>&1

    or some other file to the cronjob to capture any error messages. If this file does not get created, then the crontab failed to execute. If the file is created, then the job was executed and the file might contain some useful information about why you didn't get the expected result.

    You can google the 2>&1 part for an explanation.



  • My post didn't show up as I intended. I meant to suggest adding

    ">> $HOME/greeting.log 2>&1"

    to the cronjob. The ">>" messed up the formatting.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.