Run command on server using Plink and keep it running after disconnecting

Question:

I have a Raspberry Pi which I use to play a video on a loop. I have a button which I use to end the video to display the desktop wallpaper which I have as a static image.

To do this I use a simple Python script that launches omxplayer and loops waiting for the button to be pressed, when pressed it kills omxplayer, waits a while then re-starts the loop.

This all works fine.

I am wanting to use plink to launch this script from a Windows machine, and have used the following:

plink.exe -ssh [email protected] -pw ****** "sudo python /home/pi/ftp/files/button.py"

This launches the script no problem, but because the script does not ‘end’ the batch file just sits there.

I have other batch files using plink to kill the script and others to turn the monitor on & off using CEC all of which work fine because plink gets a return, but because the Python script runs indefinitely there is nothing returned, so plink just seems to hang.

So..Question is, can plink be told to send the command and terminate, regardless of response, or (and I’ve looked for this with no joy) is there a way of setting a timeout for plink to give up waiting for a response?

Asked By: salawinder

||

Answers:

If I understand your question correctly (not sure), you want plink to start the the script on the server and exit (keeping the script running).

The plink is just an alternative SSH client, similar to OpenSSH ssh. So just use the same techniques you will find on Internet for ssh.

Two of zillions of questions on this topic:

Answered By: Martin Prikryl
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.