0

I can't figure out how to get python to reboot my raspberry pi once a day. I have no code to show for what I have tried. I'm sure someone here can tell me how.

UNKNOWN
  • 105
  • 10
  • 3
    Does this answer your question? [restart local computer from python](https://stackoverflow.com/questions/4629131/restart-local-computer-from-python) – bantix Apr 07 '20 at 17:11
  • Sorry "bantix" but this is a raspberry pi not a windows device that I'm using. Thanks for tying though – UNKNOWN Apr 07 '20 at 17:37
  • 1
    What exactly is the issue? Have you done any research? A simple google search leads to plenty of information. – AMC Apr 07 '20 at 19:43

1 Answers1

1
import os
os.system("reboot")

Look into cron jobs on the operating system of your choice to execute this regularly

Execute a daily reboot on a raspberry pi

Go to shell, give the python script execution rights with sudo chmod +rwx /path/to/script.py

sudo su
nano /etc/crontab

Enter in the crontab file the following

@daily     root      /path/to/script.py
Björn
  • 1,610
  • 2
  • 17
  • 37