Crontab won't start Python script

My crontab won't start my script. Here is what I have:

0 8 * * * /usr/bin/python /var/www/garagestatus2.py

It should start the script at 8 am every day. Did I write the script
correctly? Is that why it doesn't start?
dynamicOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Seth SimmonsSr. Systems AdministratorCommented:
if you run that command line just like that manually does it work?
0
dynamicOneAuthor Commented:
haven't tried that, I'll give it a try and let you know.
0
dynamicOneAuthor Commented:
Did I do this right? See attached.
crontab-cmd.png
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Seth SimmonsSr. Systems AdministratorCommented:
run this manually
/usr/bin/python /var/www/garagestatus2.py

the 0 8 * * * is for cron defining what time to execute
0
dynamicOneAuthor Commented:
it works when I do that.
0
Seth SimmonsSr. Systems AdministratorCommented:
is the cron service actually running?
if you do service crond status what does it show?

are there any custom environment variables being defined in your shell profile that are needed for the script?
0
slubekCommented:
Maybe it's a stupid question, but how do you know that the script doesn't start?
0
dynamicOneAuthor Commented:
You may have found it, it says unrecognized service when I do that.
0
dynamicOneAuthor Commented:
Not a stupid question at all. The script will send me a text message when my garage door opens and closes.
0
dynamicOneAuthor Commented:
When I do 'sudo crontab -e' it loads and I can load the command for the script at the end.

When I did 'service crontab status' it says service unrecognized.
0
Seth SimmonsSr. Systems AdministratorCommented:
service is crond; crontab is used to edit the cron table

my previous comment said service crond status though if non-root then sudo /sbin/service crond status

if it says it is stopped then sudo /sbin/service crond start and sudo /sbin/chkconfig crond on so it starts on boot.  

just to clarify, what distribution are you using?
0
slubekCommented:
Sending text messages may be affected in many ways, for example by environment variables as seth2740 mentioned. Have you tried running via crontab any simple scripts, like writing something into log file?
0
dynamicOneAuthor Commented:
This is what I get when I used the following line:

sudo /sbin/service crond status

sudo: /sbin/service: command not found
0
dynamicOneAuthor Commented:
I am running raspbian on a raspberry pi.
0
slubekCommented:
On raspbian you can start crond by:
/etc/init.d/cron start

Open in new window


If you run /etc/init.d/cron without parameters you should see another options. One of them should be something like
/etc/init.d/cron status

Open in new window

which shows you if the crond is running.
You can also check it with:
ps ax | grep crond

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Python

From novice to tech pro — start learning today.