[BUG] internal: Run shell path (local) - just throwing errors
Hi
Im trying to get the "internal: Run shell path (local)" to work.... I suspect that im just being a bit daft but I have spent a while seaching for what im doing wrong - couldnt find a solution or pointer that helped ...
Anyway im trying to use this action to run a shutdown comand on the pc - is this even possible? Or is it outside the scope of this action? I have tried just entering multiple varations of the actual comand into the path box, creating a .bat , .cmd file with the shutdown comand (that runs fine if run directly) No matter what I put in i just get this warning in the log:
10. 11:44:17 instance(internal): Shell command failed. Guru meditation: {"killed":true,"code":null,"signal":"SIGTERM","cmd":"shutdown -r"}
shutdown -r = obviously replaced with whatever I entered into the path box
EDIT - Running Win10 and latest alpha version of companion
Any pointers would be greatly apprecited
Ta very muchly
Issue-Label Bot is automatically applying the label BUG to this issue, with a confidence of 0.72. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
I have the same problem....
I'm getting the same issue when trying to run an amixer command to mute or unmute audio on a Raspberry Pi 4. Interestingly though, when I use it to run an xset command, it throws the error but the xset command still works. However, the amixer command throws the error, but does not work. I have verified from the command line that both command works fine. The commands in question are:
Both sets of commands are used with a toggle button. /usr/bin/xset -display :0 dpms force off /usr/bin/xset -display :0 dpms force on
/usr/bin/amixer set Master mute /usr/bin/amixer set Master unmute
@ryanhowerton have you checked that the user running companion has permission to execute those and it doesn't need to be done as root?
I run a script on the pi calles shutdownpi.sh, in that script sudo shutdown -h now is called, try that first and see if there is any other issue (its in the tools dir)
So, what I have uncovered is that the xset command throws an error but still runs (albeit not reliably). The amixer command will not work without using sudo when running from companion. It will run from the command line just fine and works as expected. When running with sudo it becomes problematic as the controls exposed to the pi user and the controls exposed to the root user are different controls and do not work the same. In either case, the question becomes should a script ran from companion be ran as the pi user? If so, then would there be an appropriate way to set the environment to work correctly?
I've implemented a workaround. I've used a semaphore file with a watchdog. The command "touch" throws the error, but still writes the file.
For me it works, I execute /home/pi/shutdown.sh
Which contains.. #! /bin/sh sudo /sbin/shutdown -h now
For this to work User pi needs to be able to execute shutdown without a Passwort. Also the enviorment it execute in may Not contain a proper Path hence i would try to explicitly say where something is execute. like /sbin/shutdown and so on.
Same issue here. Actually had it working on a different computer using this:
taskkill /F /IM vlc.exe /T
However had to switch to a different machine and am now in the same boat.
We did drop a fix to allow the timeout for shell exec to be defined alongside the path: https://github.com/bitfocus/companion-module-bitfocus-companion/pull/11
Using the latest 2.1.0 stable release, if you adjust the timeout for a longer period @mattrog @houtacheng @ryanhowerton @hsteppke does this resolve the original issue? Originally the hard coded timeout was 5ms and this changed the default to 5s.