New to this, how do I run a script on startup?

The Raspberry Pi is a series of credit card-sized single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and developing countries.

Post Reply
User avatar
/RaspberryPi
Corporate
Posts: 2449
Joined: Wed Jun 05, 2019 1:29 am

New to this, how do I run a script on startup?

Post by /RaspberryPi »


Hi! I'm attempting to use a raspberry pi zero as a 24/7 streaming webcam on youtube. Everything works with the terminal command I have when I SSH.

raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/UNIQUE-PRIVATE-KEY I have tried adding the above code direclty to the crontab -e file by writing

@reboot MY-ABOVE-CODE & But this didn't work.



I then tried creating a python file with the print command. and writing

print('MY-ABOVE-CODE') This also didn't work.

I'm now attempting to have this command run when I power on the pi.

How do I accomplish this?
submitted by /u/destinationsound
[link] [comments]

Source: https://www.reddit.com/r/raspberry_pi/c ... n_startup/
/RaspberryPi
Post Reply

Return to “Raspberry Pi Forum”