Hm, IIUC can't the remote script sleep-loop and send output back asynchronously. (More reseach needed on async piece)..
$ssh->system('/path/to/remote_script arg, arg,...'); #!/bin/... # remote_script for (...); do get_temp_probe(); ..... ; sleep 300; done On Tue, Apr 18, 2017 at 6:19 PM, lee <l...@yagibdah.de> wrote: > > Hi, > > I'm trying to repeatedly execute a command on a remote machine and > to capture the output with a perl program. > > I have tried Net::OpenSSH and Net::SSH::Perl. Both log in, execute the > command, capture the output --- and then log out. According to the log > file of the remote machine, Net::OpenSSH logs out by closing the > connection after running the command once despite being designed > otherwise. Net::OpenSSH is designed to log out after each command. > > > Since I want to execute the command repeatedly (over long periods of > time in intervals of maybe 300 seconds), I do not want to close the > connection to the remote machine until my perl program is finished. > > How could this be achieved? > > > The purpose is to get room temperature readings which are stored in a > table in a mysql database. I haven't found any device at a reasonable > price that would reliably provide such readings. > > Using lmsensors works, but the readings are too much influenced by the > temperature of the server. I have a switch that provides pretty stable > temperature readings which I might be able to use instead, and to get > those, I have to log in to the switch and issue a command that shows its > temperature. > > Hence I don't want to log in and out all the time just to get a > temperature reading. > > > Suggestions for reliably getting a room temperature reading are also > welcome. I do not want to use the serial port because I sometimes need > it to connect to a console port on a switch or router, and there's only > one serial port. I could use the parallel port or usb, though. > > I'm not really inclined to solder some sort of diy thingy myself as I'd > probably overheat the parts and do more damage than anything else; it's > just not my thing doing that kind of stuff. > > If anything fails, I could get away by hooking up a simple thermostat > which opens and closes a contact depending on temperature, as long as I > can get a reading whether the contact is opened or closed. It won't be > a good solution, yet better than nothing. > > I'm aware that there are USB sticks ("temper") that /might/ work, but > from what I've been reading, they seem rather unreliable even if you can > get one to work. > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/