079-A simple scheduled task

1. User requirements: 10.0.2.178 and 10.0.2.187, the two servers
/app/onesearch/logs directory can only keep logs for 5 days, default.log should keep the file
/app/AsposeConverter_HTML/Linux/logs directory by default. 5 days of logs, the converter.log file should be kept by default 
2. Operation process
cat /home/vkapp/start.sh 
#/bin/bash
#create by xiongchao at 20180305
cd /app/onesearch/logs/
find /app/onesearch/ logs/ -type f -mtime +4 -iname "default.log-*" -exec rm -f {} \;
cd /app/AsposeConverter_HTML/Linux/logs/
find /app/AsposeConverter_HTML/Linux/logs/ -type f -mtime +4 -iname "converter.log.*" -exec rm -f {} \;

Scheduled task script:

chmod +x   /home/vkapp/start.sh
 * * */3 * *  /bin/sh  /home/vkapp/start.sh    >&  /dev/null

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325313690&siteId=291194637