Shut down command via URL

Raspberry Pi related support

Shut down command via URL

Postby mapchen » 06 Apr 2016, 18:38

Hello,

I was searching for a way how to shut down my rasp pi via a browser url.

As you can do that in the runeaudio web gui it should be somehow possible. Reason i ask is because i want to control it via my home automation system. I am unfortunately not a linux expert.

If i have understood the client code correctly its using a form for submitting a shutdown command.

Br
Matthias
mapchen
 
Posts: 1
Joined: 06 Apr 2016, 18:32

Re: Shut down command via URL

Postby LarsP » 08 Feb 2019, 11:05

You're exactly asking what I want to know too :)

I hope someone knows it now, 3 years later :D
LarsP
 
Posts: 3
Joined: 08 Feb 2019, 11:02

Re: Shut down command via URL

Postby LarsP » 14 Feb 2019, 22:32

It's possible to play, pause, stop, load playlist, set volume by http command.

See: control-play-pause-volume-over-tcp-t3137.html

And: https://www.musicpd.org/doc/html/protoc ... and-setvol

As far as I understand, it are all commands to control the MPD engine. (and not the "Rune-Part") correct me if i'm wrong..


So if anyone knows a trick to shut down a RPI at a certain time, I'd like to hear that!
LarsP
 
Posts: 3
Joined: 08 Feb 2019, 11:02

Re: Shut down command via URL

Postby LarsP » 16 Feb 2019, 21:54

Oke, solved it by making a Crontab!
Maybe it is usefull for somebody else to know how:

- Login by ssh into pi:
login: root
password: rune

- Enable cron:
Code: Select all
systemctl enable cronie

Code: Select all
systemctl start cronie


- Use Nano to edit crontab:
Code: Select all
sudo EDITOR=nano crontab -e -u root


and then add the following lines:

Code: Select all
30 23 * * 1-5 /sbin/shutdown -h now

Code: Select all
30 10 * * 0,6 /sbin/shutdown -h now



this would shutdown the Pi at 23:30 from Monday to Friday and on 10:30 on Saturday and Sunday.



The structure is very simple:

1. The number of minutes after the hour (0 to 59)
2. The hour in military time (24 hour) format (0 to 23)
3. The day of the month (1 to 31)
4. The month (1 to 12)
5. The day of the week(0 or 7 is Sun, or use name)
6. The command to run
More graphically they would look like this:
* * * * * Command to be executed
- - - - -
| | | | |
| | | | +----- Day of week (0-7)
| | | +------- Month (1 - 12)
| | +--------- Day of month (1 - 31)
| +----------- Hour (0 - 23)
+------------- Min (0 - 59)

Have fun! :D
LarsP
 
Posts: 3
Joined: 08 Feb 2019, 11:02

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 9 guests