Nginx Log Cutting script

Source: Internet
Author: User

This script is an nginx log cut script

Variable Nginx_path to nginx installation directory

Variable Log_path to nginx log directory

You only need to modify these two variables, and then add them to the scheduled task.


#!/bin/bash

Nginx_path=/opt/nginx_web

Log_path=/opt/nginx_web/logs

yesterday=$ (date-d ' Yesterday ' +%y-%m-%d)

MV $LOG _path/access.log $LOG _path/access_$yesterday.log

$NGINX _path/sbin/nginx-s Reopen

CD $LOG _path

if [!-e Access.log]

Then

Touch Access.log

Else

Exit 2

Fi


This article is from the "STARTUPPP" blog, make sure to keep this source http://startuppp.blog.51cto.com/11847460/1872763

Nginx Log Cutting script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.