User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

How to run python script on my pi, like Win. Task Scheduler

Tue Mar 10, 2015 11:38 pm

Hi All,

I have a nifty little python script that I can run and output the temperature to a text file, normally run using Putty by typing:

Code: Select all

sudo python logTemp.py
Now I would like to turn my PC off and have the headless pi automatically run this script on a predetermined schedule... For example, run every day at midday.
I am familiar with Windows Task Scheduler and have scripts running automatically overnight on my work PC, but I want to turn my PC off and have the pi run this itself.

What should I google in order to learn this (assumingly) simple task??

Thanks
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

User avatar
DougieLawson
Posts: 39302
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to run python script on my pi, like Win. Task Schedu

Tue Mar 10, 2015 11:45 pm

For recurring events use cron
For once off events use at

at 23:59 <<< echo "One minute to midnight"
at now +25 min <<< rm -rf / # destroy the root filesystem
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
some_evil
Posts: 205
Joined: Thu Dec 18, 2014 3:16 am
Location: Albury, Australia

Re: How to run python script on my pi, like Win. Task Schedu

Tue Mar 10, 2015 11:56 pm

DougieLawson wrote:For recurring events use cron
Thanks again Dougie!

Perfect, you pointed me to cron, so I googled it and this spelled out how to use it:
http://www.raspberrypi.org/documentatio ... ge/cron.md
PiZeroW - May 2017
Pi 3 - Oct 2016
PiZero - June 2016
Pi 2 - Jan 2016
Pi B+ - Dec 25 2014

Return to “Beginners”