TobivanHernobi
Posts: 7
Joined: Sat Feb 15, 2014 6:47 pm

shutdown -time directly while booting

Tue Apr 28, 2015 1:26 pm

Hello,
I want to add a "shutdown -Ph time" right while/after booting. So I added a line in rc.local like "sudo shutdown -Ph 60". Unfortunately that doesn't work, in other words: the Raspi stops right at that line and doesn't do anything at all, just cursor-blinking.
So I tried to point at "/usr/local/shutdown_script.sh" which contains the shutdown command: same problem: booting hangs.
Any ideas? Thank you very much.

User avatar
RaTTuS
Posts: 10563
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: shutdown -time directly while booting

Tue Apr 28, 2015 1:39 pm

in rc.local you don't need sudo as it is root anyway
you will also block anything else from happening
so
you also cannot login to a system that is being shutdown[within 5 mins]
so you need to think how long and exactly what oyu want to do
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

TobivanHernobi
Posts: 7
Joined: Sat Feb 15, 2014 6:47 pm

Re: shutdown -time directly while booting

Tue Apr 28, 2015 1:44 pm

I want to boot the Raspi which functions as a printing-server using CUPS. After let's say 5 hours (time=300) the Raspi should automatically power off. Next day it is being turned on via clock-timer (and then after booting plus 5 hours shutdown again and so on).

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

Re: shutdown -time directly while booting

Tue Apr 28, 2015 4:45 pm

Why not just leave it active? It costs £4.38 per year to run a Raspberry Pi at full load.
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.

TobivanHernobi
Posts: 7
Joined: Sat Feb 15, 2014 6:47 pm

Re: shutdown -time directly while booting

Wed Apr 29, 2015 11:41 am

That is not the question, please. Situation is as described.

User avatar
kusti8
Posts: 3439
Joined: Sat Dec 21, 2013 5:29 pm
Location: USA

Re: shutdown -time directly while booting

Wed Apr 29, 2015 11:47 am

Add an & to the end of the shutdown script in rc.local.
There are 10 types of people: those who understand binary and those who don't.

TobivanHernobi
Posts: 7
Joined: Sat Feb 15, 2014 6:47 pm

Re: shutdown -time directly while booting

Tue May 05, 2015 1:56 pm

Thank you very much, kusti8

Return to “Raspberry Pi OS”