I am using nano 2.7.4 and have created a file to receive sensor data to table in SQL. I'm able to run the task form the command line and receive the correct data back in the database. However, the program will not run on its own.
Your crontab contains only commented lines... include at least one line without the
#, likely that last line, which should read:
/10 * * * * /home/pi/tempLog/readTempSQL.py
#/10 * * * * /home/pi/tempLog/readTempSQL.py
Per this page mind that:
Repeat pattern like /2 for every 2 minutes or /10 for every 10 minutes is not supported by all operating systems. If you try to use it and crontab complains it is probably not supported.
The shebang of your script should have another slash
As @Ghanima has said, you must first remove the comment character (#) in the line that you wish to execute (and probably the leading
/). But you may also need to make another change before that will execute - you will need to indicate how you want your Python script executed. So, your revised line will look like this:
10 * * * * /usr/bin/python3 /home/pi/tempLog/readTempSQL.py
I have assumed that your script runs under Python 3. If instead you wish to use Python 2, change the python path accordingly.
cron does not have the same $PATH as you do (as user
pi), and so you must provide that information. One other thing that might help is to redirect any stderr output (errors) to a file as this may be useful in debugging any issues that occur. If you wish to do this:
10 * * * * /usr/bin/python3 /home/pi/tempLog/readTempSQL.py > /home/pi/cronjoblog 2>&1