From 889ef3fb69b8d39f5e73d32d1e127b744cedd28f Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Mon, 11 Dec 2023 18:06:07 +0800 Subject: [PATCH] update --- bash/record.sh | 3 +-- bash/start_push_stream.sh | 2 -- bash/stop_push_stream.sh | 2 -- conf/example/cron.conf | 14 ++++++++++---- conf/main/common.conf | 2 +- delete_than20G.py | 3 ++- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/bash/record.sh b/bash/record.sh index 732f273..890b016 100755 --- a/bash/record.sh +++ b/bash/record.sh @@ -8,5 +8,4 @@ CURRENT_TIME=$(date +"%Y-%m-%d_%H-%M-%S") # 构建录像文件名 OUTPUT_FILE="${OUTPUT_DIR}/${CURRENT_TIME}.mp4" # 开始录制RTSP流 -/usr/bin/ffmpeg -rtsp_transport tcp -i "${RTSP_URL}" -c copy -c:a aac -s 1920x1080 -r 15 -crf 35 -t "${RECORD_DURATION}" -f mp4 "${OUTPUT_FILE}" - +/usr/bin/ffmpeg -rtsp_transport tcp -i "${RTSP_URL}" -c copy -c:a aac -s 1920x1080 -r 15 -crf 35 -t "${RECORD_DURATION}" -f mp4 "${OUTPUT_FILE}" \ No newline at end of file diff --git a/bash/start_push_stream.sh b/bash/start_push_stream.sh index d536bca..6b949e7 100644 --- a/bash/start_push_stream.sh +++ b/bash/start_push_stream.sh @@ -1,4 +1,2 @@ #!/bin/bash -set -e - supervisorctl start push_stream diff --git a/bash/stop_push_stream.sh b/bash/stop_push_stream.sh index 19aa07e..855eaeb 100644 --- a/bash/stop_push_stream.sh +++ b/bash/stop_push_stream.sh @@ -1,4 +1,2 @@ #!/bin/bash -set -e - supervisorctl stop push_stream diff --git a/conf/example/cron.conf b/conf/example/cron.conf index 9831e93..bc7d10b 100644 --- a/conf/example/cron.conf +++ b/conf/example/cron.conf @@ -1,4 +1,10 @@ -# 定时任务 -*/15 * * * * /usr/bin/python /home/pi/lot_manager/delete_than20G.sh -# 针对32G内存卡的定时 -*/15 * * * * /usr/bin/bash /home/pi/lot_manager/bash/cron_delete_mp4.sh +# 公共定时任务 +# 每小时0分执行 +0 * * * * /usr/bin/bash /home/pi/lot_manager/bash/cron_delete_mp4.sh +# 每天0:0分执行 +0 0 * * * /usr/bin/python /home/pi/lot_manager/delete_lot_data_3_days.py + + +# 针对32G内存卡的定时,额外加这个 +# 每隔15分钟进行 +*/15 * * * * /usr/bin/python /home/pi/lot_manager/delete_than20G.py diff --git a/conf/main/common.conf b/conf/main/common.conf index 52945c0..0cfd144 100644 --- a/conf/main/common.conf +++ b/conf/main/common.conf @@ -5,6 +5,6 @@ port=1883 [record] post_record_list_url=https://shop.lihaink.cn/api/index/file_list post_record_url=https://shop.lihaink.cn/api/index/upload -[message_type] +#[message_type] diff --git a/delete_than20G.py b/delete_than20G.py index e4b1e1d..b7e2b23 100644 --- a/delete_than20G.py +++ b/delete_than20G.py @@ -17,8 +17,9 @@ while True: oldest_file = min(files_info, key=lambda x: x[0])[1] # 删除最旧的文件 os.remove(os.path.join(folder_path, oldest_file)) + print("删除" + oldest_file) else: # print("文件夹小于20G") break # 等待5秒钟 - time.sleep(5) + time.sleep(1)