Home > Software design >  Plink & looping Python script
Plink & looping Python script

Time:08-05

I did some searching, but as usual it looks like I'm trying to do something weird...

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?

CodePudding user response:

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:

  • Related