Delete logs files regularly under linux and windowdown

linux and windowdown regularly delete tomcat logs script

1. Import the deLog.sh file under the root/directory (you can refer to delete the logs timer ).

Note: If the script is a Windows version, it needs to be converted to a linux version before it can be used in linux. (For the conversion method, please refer to the conversion method of windows script to linux script )

2. Check whether the path of Tomcat logs (uploaded file deLog.sh) is correct wq/q save or exit

[root@localhost ~]# vim deLog.sh

3. Execute the deLog.sh file to display the following content (successful startup):

[root@localhost ~]# sh deLog.sh

4. Create a scheduled task on linux. Take the root user's scheduled task as an example.

[root@localhost ~]# crontab -e

##The content of the scheduled task file is as follows:

05 21 * * * sh /root/delLog.sh > /root/del_Log.log 2>&1

## Content meaning:

## Run the /root/delLog.sh script every day at 21:05, and write the screen output to the /root/del_Log.log file.

After completion, enter :wq and press Enter to save and exit.

5. View the verification plan task

[root@localhost ~]#  crontab -l

Guess you like

Origin blog.csdn.net/Xin_shou__/article/details/128298441