-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
turn off one pi from another?
I was wondering if I could in some way turn off a pi running raspbian using a pi with openelec so I don't have to turn my pc on just to turn it off. also as a last resort how well does an IR sensor work with raspbian? I got one working with openelec but I don't want build a second IR if theres another way.
-
- Posts: 14415
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: turn off one pi from another?
Use ssh (or PuTTY) to get from one Pi to the other. Issue the shutdown command. Done.
I occasionally do that (though both Pis are running Raspbian). More commonly I use on Pi to shut down a particular process on the other.
I occasionally do that (though both Pis are running Raspbian). More commonly I use on Pi to shut down a particular process on the other.
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
can you send an ssh command from openelec? also I said before I don't want to use a PC with putty to turn it off.
-
- Posts: 14415
- Joined: Fri Mar 09, 2012 7:36 pm
- Location: Vallejo, CA (US)
Re: turn off one pi from another?
PuTTY certain runs on Raspbian (I've never used openELEC so I couldn't say if there is a version there), but you need to bring up the GUI to do so. PuTTY is useful for having one or more available configs with different settings, or for people who have issues with command line (not just "afraid of", but also "which options do I need this time?").ViolentMonk wrote:can you send an ssh command from openelec? also I said before I don't want to use a PC with putty to turn it off.
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
I was wanting the ssh to come from openelec not raspbian because the other pi is headless. I have an IR remote/receiver for my openelec pi to turn it off. would it be best just to get another receiver for the headless or is there a way to ssh from openelec?
Re: turn off one pi from another?
Check the OpenELEC forum on how to get to the command-line.
I suppose OpenELEC is the wrong distro , it doesn't have
package managment and X. I guess a commandline SSH client
might still be included.
AFAIK on RaspBMC you can install anything you could on
Raspbian , including a desktop and then PuTTY.
ghans
I suppose OpenELEC is the wrong distro , it doesn't have
package managment and X. I guess a commandline SSH client
might still be included.
AFAIK on RaspBMC you can install anything you could on
Raspbian , including a desktop and then PuTTY.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: turn off one pi from another?
Sure,
on both raspberry Pi's you issue (as root)
ssh-keygen
and create a keypair WITHOUT a passphrase(just enter)
look at the Public part of the key
and paste that into the authorized keys file of the other pi
vi .ssh/authorized_keyz
if you do so you can login from one pi to the other without being prompted for a password.
The two machines trust each other.
so if you create a script
and save it somewhere let see /root/remoteshutdown.sh make it executable ()
For the next step create a shortcut or a command... I googled a bit..
WARNING UNTESTED
take a look at
http://forum.xbmc.org/showthread.php?tid=140782
on both raspberry Pi's you issue (as root)
ssh-keygen
and create a keypair WITHOUT a passphrase(just enter)
Code: Select all
openelec:~ # ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/storage/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /storage/.ssh/id_rsa.
Your public key has been saved in /storage/.ssh/id_rsa.pub.
The key fingerprint is:
03:73:af:9f:6b:d0:f8:8b:d4:b9:b6:b0:5d:3b:5e:24 root@openelec
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| o . |
| + . |
| So. E . |
| o+.. o |
| +oo . . |
| . *++.o |
| ooO=o. |
+-----------------+
openelec:~ #
and paste that into the authorized keys file of the other pi
Code: Select all
openelec:~ # cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNrkOU5qu8Isy1gO5ibBu2su6IJoBU/AmVF8wpnLMLxnyf7BzJPPp7wUNJMOFc8o49XZkNnM5JaSJWXGil89GNsb804LdqB0yieGwm9RFSL2xiilEF7i7pcSeS9WHDSk9wIMaB6/L4LZPqcWZtCwt/K0yfOCUHO5Wt7sqDTUfPia6QgjKGqiG5jmLk1Xel592iS4P4Mcc5WUuaRZH9w0BFJTN9aVhA3a0J0Rar/E7kgherteCNRCEyjbSMrV3WysmXZhdp3rFXy924HuO24UPtKC76MAgsz1h/dQyLUASkPOwXSxJVf+jpdi0XdITHxzJO91jOE9V4kfk4qUX2Oe4X root@openelec
if you do so you can login from one pi to the other without being prompted for a password.
The two machines trust each other.
so if you create a script
Code: Select all
#!/bin/bash
host=192.168.2.123 # ip of other pi you want to shutdown
ssh $host "/sbin/halt "
Code: Select all
chmod +x /root/remoteshutdown.sh
For the next step create a shortcut or a command... I googled a bit..
WARNING UNTESTED
take a look at
http://forum.xbmc.org/showthread.php?tid=140782
Please read: http://www.biblegateway.com/passage/?search=Matthew+7%3A7&version=NIV
Use loads of sunscreen, use the search, be elaborate in questions, paste commands and error messages, and remember google is your friend!
Use loads of sunscreen, use the search, be elaborate in questions, paste commands and error messages, and remember google is your friend!
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
woo thank you! I think that's what I need I'll try it out and post if I mess it up or need more help. 

-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
welp it looks like I'm not very good at this so how do I install putty on raspbmc and start it?
- RaTTuS
- Posts: 10748
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: turn off one pi from another?
you don't need putty on raspbmcViolentMonk wrote:welp it looks like I'm not very good at this so how do I install putty on raspbmc and start it?
just the sshd
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
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: turn off one pi from another?
Check the RaspBMC forums/ homepage /Wiki on how
to get to the commandline.
ghans
to get to the commandline.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
Re: turn off one pi from another?
Actually, I am missing something in these replies
SSH into the second pi and then issuing ¨sudo halt" doesn't actually power off the Pi.
For that you also have to build a little hardware project with your pi that disconnects the power supply
There are many examples on how to do this on this forum:
For example: use a little relay circuit on the first pi to switch off the mains for the second Pi
Or even simpler and possibly cheaper: build a simple circuitbreaker that interrupts the 5 volt line for the second pi. This can easily be controlled from the first pi via GPIO.
Haven't seen a schematic for that yet, though it is VERY simple and probably costs you only a couple of wires and a resistor.

SSH into the second pi and then issuing ¨sudo halt" doesn't actually power off the Pi.
For that you also have to build a little hardware project with your pi that disconnects the power supply

There are many examples on how to do this on this forum:
For example: use a little relay circuit on the first pi to switch off the mains for the second Pi
Or even simpler and possibly cheaper: build a simple circuitbreaker that interrupts the 5 volt line for the second pi. This can easily be controlled from the first pi via GPIO.
Haven't seen a schematic for that yet, though it is VERY simple and probably costs you only a couple of wires and a resistor.
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
it says you get into commandline by hitting exit on xbmc then hit ESC on your keyboard...anyone know if i have to use a keyboard? i have a rc6 remote can I use that? I really don't have an extra keyboard..also I know it doesnt "power it off". I switch off the power using a surge protector and a wall light switch. I just want to be able to "safely" turn them off with sudo halt from the first pi then shut off the power when I leave the room.
Re: turn off one pi from another?
Well , you could SSH into your Pi ...
Use PuTTY on Windows . Or MobaXTerm.
ghans
Use PuTTY on Windows . Or MobaXTerm.
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
I don't mean to be rude ghans but did you read the title of the thread or any of my other posts? I need one raspberry to be turned off from a second raspberry connected to a tv screen while the other is headless without sshing from a PC other than to install or set up software/settings.
Re: turn off one pi from another?
And thats what i'm suggesting. Using SSH to setup
dspollekes SSH-based solution. After that ,
you shouldn't need to SSH again from your PC.
I guess both Pis and your Laptop/Desktop are connected
to the same LAN ?
ghans
dspollekes SSH-based solution. After that ,
you shouldn't need to SSH again from your PC.
I guess both Pis and your Laptop/Desktop are connected
to the same LAN ?
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
I create the authorized keys I just cant figure out how to "paste them" into each other's authorized keys file. :/ it keeps saying E492: Not an editor command: how do I actually add the keys?
- RaTTuS
- Posts: 10748
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: turn off one pi from another?
ssh-copy-id user@remotesystem
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
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: turn off one pi from another?
Was it really necessary to recommend vi to someone
who does not know how to use it ?
ghans
who does not know how to use it ?
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
-
- Posts: 35
- Joined: Mon Jul 22, 2013 8:36 am
Re: turn off one pi from another?
when I try to ssh the key from one to the other is says there is no such file or directory. 
EDIT: I put in sudo scp /home/pi/keypair3.pub pi@192.168.0.188:keys(.170 for the second)
it looks like I got one to cooperate and accept the keypair thing but the other says access is denied. :,(

EDIT: I put in sudo scp /home/pi/keypair3.pub pi@192.168.0.188:keys(.170 for the second)
it looks like I got one to cooperate and accept the keypair thing but the other says access is denied. :,(
- RaTTuS
- Posts: 10748
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: turn off one pi from another?
http://www.raspberrypi.org/phpBB3/viewt ... 44#p404121
is how you move keys to a remote system
is how you move keys to a remote system
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
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe