slapshot136
Posts: 7
Joined: Thu Aug 09, 2012 11:20 pm

send command via lan to pi?

Sun Dec 02, 2012 6:09 pm

I have a computer (server 2012) on a UPS and would like to send a command to shut down a raspberry pi that is also connected to the UPS when the battery level gets low - I normally connect to the pi via putty, but I don't know how to set up putty to "run" without user input, how can I do this or what alternatives are there?

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: send command via lan to pi?

Sun Dec 02, 2012 6:33 pm

Normal CLI SSH Clients allow to execute a single command specified as argument.
Write a Microsoft Batch file and refer to PuTTY's docs. Would be a shame if such a feature
isn't there.


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

pjc123
Posts: 922
Joined: Thu Mar 29, 2012 3:37 pm
Contact: Website

Re: send command via lan to pi?

Sun Dec 02, 2012 9:19 pm

Putty allows you to perform "ssh.exe like" commands through the use of either the putty.exe or plink.exe commands that are included with putty.

Here are some examples:

http://irfanworld.wordpress.com/2012/11 ... echniques/
My Raspberry Pi Project Page:

https://www.flaminghellmet.com/launch/

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: send command via lan to pi?

Sun Dec 02, 2012 9:27 pm

or super quick and dirty - create a cgi script on the pi which as part of responding to the request issues the halt or shutdown and then have your 'controlling machine' just call the webpage url on the pi - you need to work out the permissions though to allow the www user on the pi issue a sudo ...
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

Return to “General programming discussion”