Log Cutting | program database backup

Source: Internet
Author: User

Log Cutting

#!/bin/bash#cut nginx logsnginx_sbin= "/usr/local/openresty/nginx/sbin/nginx" log_files_path= "/usr/ Local/openresty/nginx/logs "cut_log_files_dir="/data/logs "logfilename_array= (www.bbs.com) date= ' date +%Y-% m-%d -d  "1 days ago" "suffix=". log.gz "Projectname=" BBS "#flush  log to disk${ Nginx_sbin} -s reloadfunction cut_gzip_upload () {         gzipfilename=${log_file_name} "_" ${date}${suffix}        mv  ${log_files_path}/${log_file_name}.log ${cut_log_files_dir}/${log_file_name}_${date}.log         ${nginx_sbin} -s reload         gzip -c ${cut_log_files_dir}/${log_file_name}_${date}.log >${cut_log_files_dir}/ ${gzipfilename}         #upload  file to oss#         /usr/bin/python /root/scripts/upload.py ${gzipfilename} ${projectname}}for log_file_ Name in ${logfilename_array[@]}do        cut_gzip_upload  ${log_file_name}done


General Backup:

#!/bin/bash# #web-rsyncrsync-avz/data/wwwroot/web/data/backup/web# #mysqldumpdate = ' Date +%f ' backupdir=/data/  BACKUP/DBCD $backupdirmkdir $datecd $datemysqldump-uroot-p123456 ultrax >ultrax.sql ###### #delete backup file before 4days#######################/usr/bin/find ${backupdir}-ctime +6 | Xargs RM-RF


This article is from the "Record Drip" blog, please be sure to keep this source http://caozm.blog.51cto.com/1118764/1618927

Log Cutting | program database backup

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.