Executing .sh file at raspberry using paramiko

I have to refresh the chromium page at a raspberrypi remotelly, I managed to run a .py file but the .sh it's not executing.

If I execute on the raspberry itself, the refresh works perfectly.

Here is the code I'm trying:

import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname=hostname,username=username, password=password)

stdin, stdout, stderr = client.exec_command("bash /home/pi/refresh.sh'")

for line in stdout:
    print (line.strip('\n'))
 
client.close()

Here is the .sh file:

WID=$(xdotool search --onlyvisible --class chromium|head -1)
xdotool windowactivate ${WID}
xdotool key ctrl+F5

Does anyone have any idea of what might be happening?

Thanks in advance



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation