Files
UPC-Resent/cutlog.sh
2026-03-22 17:17:44 +08:00

9 lines
329 B
Bash

#!/bin/bash
declare logs_path="/opt/upc_resent/log";
declare need_delete_path=${logs_path}/$(date -d "7 days ago" "+%Y_%m_%d");
declare yestoday_log_path=${logs_path}/$(date -d "yesterday" "+%Y_%m_%d");
rm -rf ${need_delete_path}
rm -rf ${yestoday_log_path}
mv ${logs_path}/today ${yestoday_log_path}
mkdir -p ${logs_path}/today