Automatic backup and automatic clear log files in UNIX systems

zhaozj2021-02-16  102

-------------------------------------------------- ------------ Perform backup and empty the current log files, clear_countlog.shzcatlinux, zcatlinux@yahoo.com.cn, 2004-06-28 --------- -------------------------------------------------- -

#! / bin / bashlogfile = / var / count.logdate = `Date % y% m% d`

IF [-f $ logfile] THEN CP $ logfile $ logfile- $ DATE FIND / VAR /-CTIME 3 -NAME Count / * -exec RM {} /; echo "> $ logfilefi

-------------------------------------------------in CRONTAB implements the above script once a day! -------------------------------------------------

10 3 × × × ROOT /HOME/CLEAR_COUNTLOG.SH

转载请注明原文地址:https://www.9cbs.com/read-11102.html

New Post(0)