0

I have a task for my thesis which includes a camera and several LEDs and they can be controlled by some bash commands. To access the system, I need to run ssh root@IP and access the default path of the system. Under this path there is a script which opens the camera application by running ./foo and once it is executed, I am inside the camera application. Then, I can check the temperature of the LED's etc by typing i.e. status -t

Now my aim is to automatize this process to check the temperature by a bash script or python code. In Bash, If I run i.e ssh root@192.168.0.1, ./foo and status -t consecutively, I can get the temperature value. However, executing ssh root@192.168.0.1 './foo' 'status -t, ends in a infinite loop. If I do ssh root@192.168.0.1 './foo', I expect to be in camera application but this opens the application weirdly such that I can't execute status -t afterwards.

I tried also something like this

ssh root@192.168.0.1 << EOF
  ls
  ./foo
  status -t
EOF

refer to

or in python using subprocess ssh using python and with paramiko.

but nothing really works. What actually differs my situation from the rest of these examples is that my commands depend on each other, one opens another application and run the next command in the next application.

So the questions are 1- Does what I am doing make sense and is it even possible? 2- How to apply is in a script/python code?

cancan
  • 121
  • 1
  • 3
  • 11
  • Does your camera application support receiving commands from stdin? I.e. does `echo "status -t" | ./foo` work? Or does it maybe have some command line options to run commands? – mihi May 10 '21 at 15:12
  • no I have tried it as well but no it does not – cancan May 12 '21 at 05:28

0 Answers0