修复日志删除逻辑

This commit is contained in:
whyour
2023-03-10 14:21:52 +08:00
parent b2167ae5e4
commit 7b2956eb0a
2 changed files with 9 additions and 5 deletions
+6 -2
View File
@@ -19,10 +19,14 @@ remove_js_log() {
diff_time=$(($(date +%s) - $(date +%s -d "$log_date")))
fi
if [[ $diff_time -gt $((${days} * 86400)) ]]; then
local log_path=$(echo "$log" | sed "s,${dir_log},,g")
local log_path=$(echo "$log" | sed "s,${dir_log}/,,g")
local result=$(find_cron_api "log_path=$log_path")
if [[ $result ]]; then
echo -e "查询文件 $log_path"
if [[ -z $result ]]; then
echo -e "删除中~"
rm -vf $log
else
echo -e "正在被 $result 使用,跳过~"
fi
fi
fi