在 /root/ 下建立 2 个文件,一个startup.sh 一个 start 文件(用于自启动)。
vim startup.sh
#!/bin/bash java -jar /root/www/warehouse.jar &
vim start
#!/bin/bash #chkconfig: 2345 10 20 #description: start xuyong-test.... cd /root/ nohup ./startup.sh 1>/root/www/logs/access.log 2>/root/www/logs/errors.log
vim splitAccess.sh 自动日志处理,删除20天前的access.log,
#!/bin/sh #description split logs time1=$(date -d 'yesterday' +%Y%m%d) cp /root/www/logs/access.log /root/www/logs/access-$time1.log gzip /root/www/logs/access-$time1.log cat /dev/null > /root/www/logs/access.log time2=$(date -d '20 day ago' +%Y%m%d) rm -f /root/www/logs/access-$time2.log.gz
vim splitErrors.sh
标签:脚本,www,logs,access,sh,自启动,日志,root,log From: https://www.cnblogs.com/sdgtxuyong/p/16939292.html