os.execute and scripts

Hi

Having just upgraded my Bedroom music player, I’m trying to duplicate some of the functionality that I had previously.

I have written a script (really simple) which is a series of curl commands to the REST API of the player

Essentially:

curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=9”
curl “192.168.70.52/api/v1/commands/?cmd=play”
sleep 600
curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=12”
sleep 900
curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=15”
sleep 1800
curl “192.168.70.52/api/v1/commands/?cmd=stop”
root@MiOS_50103066:/# cat BedroomWakeup
curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=9”
curl “192.168.70.52/api/v1/commands/?cmd=play”
sleep 600
curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=12”
sleep 900
curl “192.168.70.52/api/v1/commands/?cmd=volume&volume=15”
sleep 1800
curl “192.168.70.52/api/v1/commands/?cmd=stop”

(Yeah, I know script is perhaps overstating the case)

Anyway, executing this from the Vera CLI works every time.

Creating a scene in Vera that runs this script by:
os.execute (“/BedroomWakeup”)

Also works

Once.

If I try to run it again, no dice. Vera reports scen failed. Lua log has the
JobHandler_LuaUPnP::Run scene 26 Weekend_Alarm room 3 <0x77691320>
But not the
Scene::RunScene running 26 Weekend_Alarm <0x72f39520>

My guess is that Vera is not liking the long sleep periods. Is this likely / sensible. Is there anything I can do about it?

os.execute (“/BedroomWakeup&”) for example

TIA

C

I’d be tempted to close the stdin, stdout, and stderr as well as put it in the background as you have suggested. I haven’t tried this, though. I’m curious to know if it helps:

os.execute ("/BedroomWakeup >/dev/null 2>&1 <&- &")

[quote=“jswim788, post:2, topic:197622”]I’d be tempted to close the stdin, stdout, and stderr as well as put it in the background as you have suggested. I haven’t tried this, though. I’m curious to know if it helps:

os.execute ("/BedroomWakeup >/dev/null 2>&1 <&- &")

Thankyou. I’ve amended the code as you suggested. The success command from the web UI came back much faster, and the script is running correctly. I’ll see what happens in a little over an hour :smiley:

C

I think you may have nailed it, chap

Just run it twice from two scenes and it’s behaving as I desire.

Many many thanks

C