3

I have a Raspberry Pi model B running Raspbian. I mainly use it as a web server for development.

Because there is no reason to keep it running all night, I was wondering if there is a way to automatically shutdown the Pi at night. Then the next morning, automatically boot it back up again.

7

I think the best way to do this would be to plug a timer into the wall outlet. You know, one of those ones you use when you're traveling to do the the lights.

Have the Pi shut itself off about 15 minutes before the timer shuts itself off using a cron command.

Then, when you want it to start up in the morning, just set the timer to turn on; the Pi will boot itself up when it gets power.

Good Luck!

  • 1
    If you go for this solution, make sure you take fluctuations in the wall outlet timer into account - it might drift to power off the RPi before the shutdown command is issued – Jervelund Feb 18 '14 at 7:53
  • Besides drift, also account for daylight-savings time. The pi will automatically adjust time, while the timer does not. – Gerben Feb 18 '14 at 13:31
1

The Pi could use one of its GPIO lines to shut itself down and then a timer turn the power supply back on later.

A PIC chip could be used with a real time crystal clock or calibrated on-board clock it that were accurate enough for the application. The Pi would tell the PIC to reconnect power at a prearranged time and then tell it to shut power off. The PIC would then wait (perhaps even going to SLEEP itself if it were to be a long delay) and wake the Pi at the requested time. This could also be due to some interrupt the PIC sensed such as an alarm, day-break or a noise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.