Replies: 5 comments
-
Hello, try this #!/bin/bash
trap 'curl "http://localhost:4000/stop?name=$RTSP_PATH"; [ -z "$(jobs -p)" ] || kill $(jobs -p)' INT
curl "http://localhost:4000/start?name=$RTSP_PATH"
sleep 86400 &
wait |
Beta Was this translation helpful? Give feedback.
-
Hi @aler9 Problem is trap is not catching interrupt signal. When I do ctrl + c it will detect and call the API. When interrupt signal is called from program its not able to detect it. |
Beta Was this translation helpful? Give feedback.
-
Hello, the script i posted above was tested with runOnDemand - are you sure it's not working? |
Beta Was this translation helpful? Give feedback.
-
Hi, Yeah I tried running in debug mode and from program Interrupt signal is triggering but trap command was not able to capture it and process was still running on background. In program I changed to Kill signal and process was getting stopped. But again in trap KILL was not getting captured. |
Beta Was this translation helpful? Give feedback.
-
Hi @aler9 Issue is solved it was because API was not returning anything so curl command was waiting hence it was never getting closed. |
Beta Was this translation helpful? Give feedback.
-
Which version are you using?
v0.14.1
Question
How to call a API for runOnDemandClose?
Description
I am having a script where I am calling a API to connect stream but when there are no readers I would like to call another API to stop streaming. Whatever command I am giving in trap its not getting executed for the interrupt.
Below is my script. Am I doing something wrong here?
Beta Was this translation helpful? Give feedback.
All reactions