nacos日志
#!/bin/sh #description:clean nacos logs time1=$(date -d '20 day ago' +%Y-%m-%d) #echo $time1 time2=$(date -d '1 day ago' +%Y-%m-%d) #echo $time2 file1=/usr/local/nacos/bin/logs/ cd $file1 gzip access_log.$time2.log rm -f access_log.$time1.log.gz
nohup日志
#!/bin/sh #description: clean hmm3 nohup.out log time1=$(date -d 'yesterday' +%Y%m%d) time2=$(date -d '15 day ago' +%Y%m%d) #echo $time1 #echo $time2 cd /opt/hmm3/hmm-appserver-provider/ cp nohup.out nohup.out-$time1 gzip nohup.out-$time1 cat /dev/null > nohup.out rm -f nohup.out-$time2 cd /opt/hmm3/hmm-system/ cp nohup.out nohup.out-$time1 gzip nohup.out-$time1 cat /dev/null > nohup.out rm -f nohup.out-$time2 cd /opt/hmm3/hmm-appserver-consumer/ cp nohup.out nohup.out-$time1 gzip nohup.out-$time1 cat /dev/null > nohup.out rm -f nohup.out-$time2 cd /opt/hmm3/hmm-file/ cp nohup.out nohup.out-$time1 gzip nohup.out-$time1 cat /dev/null > nohup.out rm -f nohup.out-$time2
启动微服务
#!/bin/sh #chkconfig: 2345 80 90 #description: start nacos and spring cloud jar cd /usr/local/nacos/bin/ nohup ./startup.sh -m standalone sleep 90 cd /opt/hmm3/hmm-appserver-provider/ nohup ./startup.sh sleep 90 cd /opt/hmm3/hmm-appserver-consumer/ nohup ./startup.sh cd /opt/hmm3/hmm-auth/ nohup ./startup.sh cd /opt/hmm3/hmm-file/ nohup ./startup.sh cd /opt/hmm3/hmm-gateway/ nohup ./startup.sh cd /opt/hmm3/hmm-system/ nohup ./startup.sh cd /opt/hmm3/hmm-job/ nohup ./startup.sh
nginx的日志
/etc/logrotate.d/nginx
/var/log/nginx/*log { create 0664 nginx root daily rotate 200 missingok #notifempty compress sharedscripts postrotate /bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true endscript }
/usr/nginx/logs/*log { create 0664 nginx root daily compress rotate 200 missingok #notifempty dateext sharedscripts postrotate if [ -f /usr/nginx/logs/nginx.pid ]; then kill -USR1 `cat /usr/nginx/logs/nginx.pid` fi endscript }
若不起作用,可在crontab中创建
10 3 * * * /usr/sbin/logrotate -f /etc/logrotate.d/nginx
标签:脚本,hmm3,time1,cd,nginx,自动,nohup,日志,out From: https://www.cnblogs.com/sdgtxuyong/p/17103994.html