Skip to content

Instantly share code, notes, and snippets.

@bytepossum
Last active August 12, 2021 13:51
Show Gist options
  • Save bytepossum/157bfdc996fcfef08ac9 to your computer and use it in GitHub Desktop.
Save bytepossum/157bfdc996fcfef08ac9 to your computer and use it in GitHub Desktop.
Bash script to stop RTSP recording
#!/bin/bash
VOPATH=/media/data/motion # video output directory
MPATH=/home/pi/motion # motion log directory
CAM=1
pidfile=$MPATH/cam$CAM.pid
if [ ! -f $pidfile ]; then
echo "PID file not found. Nothing to do."
else
echo "PID file exists, stopping ffmpeg process."
read pid < $pidfile
echo "Sending SIGHUP to process $pid."
# use SIGINT for ffmpeg, SIGHUP for openRTSP
kill -HUP $pid
echo "Removing PID file $pidfile."
rm $pidfile
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment