This commit is contained in:
xyj 2023-12-02 18:26:35 +08:00
parent 241a2e766f
commit f5c5e6945c
3 changed files with 22 additions and 1 deletions

21
delete_than24.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
# 指定文件夹路径
folder="/home/pi/mp4"
# 获取文件夹的大小
size=$(du -sh "$folder" | awk '{print int($1/1024/1024)}')
echo $size
while [[ $size -gt 24 ]]
do
# 获取最早创建的文件
oldest_file=$(ls -tr | head -1 | xargs)
echo $oldest_file
rm -f $oldest_file
size=$(du -sh "$folder" | awk '{print int($1/1024/1024)}')
if [[ $size -le 24 ]]
then
exit 0
fi
done

View File

@ -3,7 +3,7 @@
RTSP_URL="rtsp://admin:123456@192.168.0.123:554/mpeg4" # RTSP流的URL RTSP_URL="rtsp://admin:123456@192.168.0.123:554/mpeg4" # RTSP流的URL
OUTPUT_DIR="/home/pi/mp4" # 录像文件保存的目录 OUTPUT_DIR="/home/pi/mp4" # 录像文件保存的目录
RECORD_DURATION=60 # 录像时长(秒) RECORD_DURATION=60 # 录像时长(秒)
INTERNAL=1 INTERNAL=2
while true; do while true; do
# 获取当前时间 # 获取当前时间
CURRENT_TIME=$(date +"%Y-%m-%d_%H-%M-%S") CURRENT_TIME=$(date +"%Y-%m-%d_%H-%M-%S")

BIN
test.mp4 Normal file

Binary file not shown.