Last active
August 12, 2021 13:51
-
-
Save bytepossum/157bfdc996fcfef08ac9 to your computer and use it in GitHub Desktop.
Bash script to stop RTSP recording
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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