I am trying to auto-start a script, that starts a video stream via vlc on a raspberry pi with raspi camera. This is the code that starts the stream:
raspivid -o - -t 0 -hf -w 640 -h 360 -fps 25 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264
I have tried to add the script to init.d which does work as the LED on the camera blinks, but the startup seems to stop the script after a second. I also tried to add the script to rc.local and autologin and it didn't even blink. I tried to edit /etc/bash.bashrc too, with the following code:
if [ $(tty) == /dev/tty1 ]; then
./script
fi
But that didn't work either. Any suggestions? The script runs fine on its own.
I should also add that the stream gives an output constantly and it can't be hidden or ignored.
sleep X
at the beginning ofscript
(whereX
is a reasonable number of seconds) and changing the line of your code into./script &
. However, I haven't tested it, it's basically only a blind shot.init.d
of course, using.bashrc
seems just wrong! The idea was simply to add a long sleep in the process.