I am running Octoprint on OrangePI Zero 2, am using PSU to control my printer send "gpio write 2 1" to power ON, send "gpio write 2 0" to power OFF. All works as expected. However I want also to turn off web cam when the printer is off, and turn it on once the printer is on, the OrangePi itself is running 24/7. Camera is controlled by a service "mjpg-streamer" and is working fine also.
What did you already try to solve it?
First I tired changing the
- ON command to "gpio write 2 1 && systemctl start mjpg-streamer"
- OFF command to "gpio write 2 0 && systemctl stop mjpg-streamer"
In this case only the first command is beeing executed - the printer starts (GPIO pin state changes) but the mjpg-streamer service state does not change.
Then I created a script ON and script OFF each containing 2 commands, same effect GPIO pin is written, but mjpg-streamer service state is not changed.
When I use any of the above approaches in the terminal all works as expected.
Any suggestions how to use 2 commands at once?