0

I'm trying to write a script that checks if something is running and start it if it isn't.

trap "kill 0" SIGINT

while :
do
    live-stream-radio --start myStream
done

The output I get though is:

start_stream.sh: 8: start_stream.sh: live-stream-radio: not found
jww
  • 97,681
  • 90
  • 411
  • 885
Orophix
  • 33
  • 1
  • 7

1 Answers1

0

The not found error makes it look as if live-stream-radio might not be on your path.

Rather than figuring out the details of your run environment, I suggest you simply specify the full path of that tool explicitly. If you're able to run the command from an interactive shell, then you can find out where it's located with the following:

which live-stream-radio

If the result is, say, /usr/local/bin/live-stream-radio, you'd simply add that to your script:

#!/bin/sh

trap "kill 0" SIGINT

while :; do
  /usr/local/bin/live-stream-radio --start myStream
done
ghoti
  • 45,319
  • 8
  • 65
  • 104