
Shell
#!/bin/bash
SERVICE="ffmpeg"
RTSP_URL="rtsp地址"
RTMP_URL="rtmp地址"
COMMAND="sudo ffmpeg -rtsp_transport tcp -i ${RTSP_URL} -vcodec copy -an -f flv ${RTMP_URL}"
if sudo /usr/bin/pgrep $SERVICE > /dev/null
then
echo "${SERVICE} is already running."
else
echo "${SERVICE} is NOT running! Starting now..."
...