The first step is to learn the basics about your Raspberry Pi. The Pi was designed to be an entry level computer for school children to learn programming, so there are many tutorials on the internet that cover the basics. Take some time to do a little studying.
Here is a basic tutorial on bash scripting and how to make your script executable.
How to Write and Run a Shell Script on the Raspberry Pi
And a tutorial on Raspberry Pi cron
How To Start Programs Automatically on the Raspberry Pi
Here is a bash script to kill ffmpeg. Save it as killffmpeg.sh .
#!/bin/bash
pkill -f ffmpeg
fi
And a script to kill ffmpeg and start your camera script. Save it as restart.sh. The bash script startup.sh is your existing ffmpeg streaming script.
#!/bin/sh
/home/pi/scripts/killffmpeg.sh
sleep 2s
/home/pi/scripts/startup.sh
Then put the restart.sh script in cron to start at whatever interval or whenever you like.
This is the absolute simplest way to restart your streaming server using a Raspberry Pi and bash scripting.