04.01.2016, 20:46
Hi,
I'm running some shell commands on a unix box via http. Not the best (and secure) solution, but an option if nobody has a better one.
http://thinkinginsoftware.blogspot.no/20...mands.html
Event script to call command:
require('socket.http')
if (event.getvalue()) then
url = 'http://x.x.x.x:8088/?cmd=/home/pi/tdtool.py%20--on%XXXXXXXX'
res, err = socket.http.request(url)
else
url = 'http://x.x.x.x:8088/?cmd=/home/pi/tdtool.py%20--off%XXXXXXXX'
res, err = socket.http.request(url)
end
You could probably shutdown your server with something like:
url = 'http://x.x.x.x:8088/?cmd=shutdown%20-h%20now'
res, err = socket.http.request(url)
Where x.x.x.x is your HTPC with node installed and the script in the url I posted running.
Jørgen
I'm running some shell commands on a unix box via http. Not the best (and secure) solution, but an option if nobody has a better one.
http://thinkinginsoftware.blogspot.no/20...mands.html
Event script to call command:
require('socket.http')
if (event.getvalue()) then
url = 'http://x.x.x.x:8088/?cmd=/home/pi/tdtool.py%20--on%XXXXXXXX'
res, err = socket.http.request(url)
else
url = 'http://x.x.x.x:8088/?cmd=/home/pi/tdtool.py%20--off%XXXXXXXX'
res, err = socket.http.request(url)
end
You could probably shutdown your server with something like:
url = 'http://x.x.x.x:8088/?cmd=shutdown%20-h%20now'
res, err = socket.http.request(url)
Where x.x.x.x is your HTPC with node installed and the script in the url I posted running.
Jørgen