SHELL Simple script Update in

Source: Internet
Author: User

1. the server needs to clean the common shared directory of the FTP server 17:30 every week, first check the/var/ftp/pub/directory, and then save the detailed list and current time information of all subdirectories and files to/var/log/ Pubdir.log the log file, and then empty the directory.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/79/53/wKiom1aOLInxyLHoAAAeLq7mBW4048.png "title=" 12.png "alt=" Wkiom1aolinxylhoaaaelq7mbw4048.png "/>


Add a scheduled task to implement a scheduled execution script every Friday

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/53/wKiom1aOLNWQaQ-NAAAdSn4jfcA290.png "title=" A.png " alt= "Wkiom1aolnwqaq-naaadsn4jfca290.png"/>650) this.width=650; src= http://s5.51cto.com/wyfs02/M01/79/52/ Wkiol1aolqvs47ddaaaqyt910us117.png "title=" B.png "alt=" Wkiol1aolqvs47ddaaaqyt910us117.png "/>



2. The database server needs to make a backup of the database directory every 3 days, to count the amount of space occupied by the/var/lib/mysql directory, to view the current date, and to log to the temporary folder/tmp/dbinfo.txt;/tmp/dbinfo.txt file,/ Var/lib/mysql Directory for compressed archive, backup to/OPT

2.1 Creating/var/lib/mysql and/opt/dbbak directories;

Mkdir-p /var/lib/mysql /opt/dbbak


2.2 Scripting File VI Dbbak.shell.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/53/wKiom1aOLxLDnJ-3AAAd8HrRO9E910.png "title=" Dbbask.png "alt=" Wkiom1aolxldnj-3aaad8hrro9e910.png "/>



2.3 Execute permissions to add scripts

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/79/52/wKioL1aOL0mSYMKTAAAOHLg3tWg577.png "title=" Qq20160107153502.png "alt=" Wkiol1aol0msymktaaaohlg3twg577.png "/>


2.4 Defining Scheduled Tasks Crontab-e

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/53/wKiom1aOLzezDRZDAAAPwmMW0SU101.png "title=" Qq20160107153630.png "alt=" Wkiom1aolzezdrzdaaapwmmw0su101.png "/>


3.

3.1 Creating Mkdir-p/var/log/runrec

3.2 Scripting, VI Monitor.shell

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/79/53/wKiom1aOKgDiTdzsAAAnLEkyfQY399.png "title=" Qq20160107165938.png "alt=" Wkiom1aokgditdzsaaanlekyfqy399.png "/>

VI Rtbackup.shell

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/79/52/wKiom1aOIZaA74V5AAAcAScVDQs213.png "title=" Qq20160107162343.png "alt=" Wkiom1aoizaa74v5aaacascvdqs213.png "/>


3.3 Configuring Script Execution permissions

chmod u+x Monitor.shell

3.4 Creating a Scheduled task Crontab-e

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/79/53/wKiom1aOLBfAbQsjAAASy92pTi4404.png "title=" Qq20160107170843.png "alt=" Wkiom1aolbfabqsjaaasy92pti4404.png "/>


This article from "Gentleman to Beware of Alone" blog, please be sure to keep this source http://158573116.blog.51cto.com/8288521/1732636

SHELL Simple script Update in

Related Article

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.