Project

General

Profile

Feature #1996 » cutlog.sh

yanwei li, 04/27/2022 03:14 PM

 
1
#!/bin/bash
2
log_pathone=/var/log/nginx/access.log
3
log_pathtwo=/var/log/nginx/error.log
4
save_pathone=/var/log/nginx/access_$(date +%Y%m%d -d 'yesterday').log
5
save_pathtwo=/var/log/nginx/error_$(date +%Y%m%d -d 'yesterday').log
6
cp $log_pathone $save_pathone && echo > $log_pathone
7
cp $log_pathtwo $save_pathtwo && echo > $log_pathtwo
(3-3/5)