Linux shell simple implementation of automatic database backup

Take the CentOS system as an example to realize automatic database backup.1. Write a shell: 12 #! /bin/bashMysqldump -cp --user=root --password=' 123 ' dbName | gzip > ~/db/dbname -'date +%y%m%d%H '. SQL. GZ ;

manipulating databases with Shell commands

Use the-e parameter of MySQL can perform various kinds of SQL (create, delete, add, erase, change, check) and other operationsUsageMysql-uxxx–pxxx-e "MySQL Command" Of course, you can also use the following notation MYSQL-E-uxxx–pxxx "mysql

Shell's common script

1 Batch Create users:#!/bin/bashI=30Groupadd Class2While [$i-le 50]DoIf ID user$i &>/dev/nullThenecho "This user$i is exist"ElseUseradd-g class2 user$i && echo "User$i" | passwd--stdin user$i &>/dev/null && echo "This user$i is created"Fi((i++))Done2

Write bulk-packaged log scripts with the shell

Script 1#!/bin/bashdate=$ (date +%y%m%d%h%m) name=$ (echo $1 | awk -f ', '   ' {Print NF} ') Log_path= "$" if [ $# -ne 2 ];then    echo  "USAGE: sh  $0 log_name1,log_name2 log_path "    exitfifor NUM in " seq  1  $NAME ' do    log_name=$

Basic Process Control for shell scripts

If ElseRead-p ' Please enter the score: ' Scoreif [$score-lt 60]; Thenecho ' 60 points below ' Elif [$score-lt 70]; Thenecho ' 60-70 minutes between ' elif [$score-lt 80]; Thenecho ' 70-80 minutes between ' elif [$score-lt];thenecho ' 80-90 minutes '

Shell script expands LVM new partition with one click

Recently received the manager request to the RHEL7 LVM new partition expansion automation, because uses the virtualization platform, therefore uses to add the new disk the way to do:#!/bin/bash# #在线扫描新磁盘# #Step1: Recognize New hard

[Shell programming] Preface

1. Purpose(1) Shell knowledge Summary. Good memory is better than bad writing, finishing the relevant shell knowledge and combining their own practical experience to organize, the content will not involve all the knowledge points, will only cover

CENTOS7 Create daemon with shell and set as system service, boot automatically start

The first is to create the shell daemon: (shouhu.sh)#!/bin/bashtest () {        while true         do                 ls ./  >> 123.txt                 sleep 5                              done}case $1 instart)         path= "/root/shouhu.pid"       

About variable settings in the shell

Defining variablesA=Assigning values to variablesA=5' Number equals $ ()[Email protected] ~]# hostnameLocalhost.localdomain[Email protected] ~]# a= ' hostname '[Email protected] ~]# echo $aLocalhost.localdomain${-} to determine whether the variable

Shell DD Backup System

Backing up MBR, root partition, boot partition#!/bin/bashBak_dir=/mnt #已挂载的移动硬盘或其他外设Mbr= ' fdisk-l |grep ' Disk ' |awk nr==1 ' {print $} ' |awk-f '/' ' {print $} ' |sed s/://g 'root= ' df |awk '/\//{print} ' |awk nr==1 ' {print $} 'boot= ' df |awk '/

Linux Shell nature and how it works

The nature of the shell The shell of the Linux system is equivalent to the "one shell" of the operating system, which is the command language interpreter, which provides the user with an interface to use the operating system. It does not belong to

Summarize the 8 tips you use frequently with shell command line

Original blog, reproduced please indicate the sourceThe shell is the command interpreter.See which shells are supported by this system1 Tab Command completionThis almost every time can be used, for example, I have a file called file.txt, assuming

Shell parameter expansion

Using SH to write small scripts can make the job easier. Part of the content may be more unfamiliar to everyone (at least I am).is the variable related to the expansion, the following are some simple description and use of the method. To make the

Seq in the shell magical

Add 20 users to the CLASS01 group in bulk, the user name begins with STD, ends with a number, format: STD01---STD20Method 1#!/bin/shgroupadd class01a=stdfor ((i=1;iMethod 2:#!/bin/bashgroupadd class01for i in {1..20}doif [$i-lt];thenuseradd "std0$i"-

Shell Bulk Add Users

#!/bin/bashRead-t 30-p "Please input user name:" NameRead-t 30-p "Please input user number:" numRead-s-T 30-p "Please input user password:" PassEcho-e "\ n"if [!-Z "$name"-A!-Z "$num"-A!-Z "$pass"]ThenY=$ (echo "$num" | sed-e ' s#^[0-9]# #g; s#[0-9]*

Java Learning notes-sorting algorithm of hill sort (Shell sort)

The head of the Sunset Building, the voice of the hung, Jiangnan wandering. The Wu hook to see, the railing shot all over, no one will, boarding meaning. --Deng Jiankang and Heart PavilionThe hill algorithm is a sort algorithm proposed by Hill

Shell script Basics--arrays

Q1. ArraysWe know that variables are memory space, each variable can only store a single data, a one-time assignment operation, then encountered some need to continuously store and read the task, if you still rely on the variable for multiple

Java calls the shell script and returns the result set

1 /**2 * Run shell scripts3 * @paramShell scripts that the shell needs to run4 */5 Public Static voidExecshell (String shell) {6 Try {7Runtime RT =runtime.getruntime ();8 rt.exec (shell);9}Catch(Exception e) {Ten

Shell sequencing of data structures

#SIZE 10Direct Insert Sortvoid Insert_sort () {int i,j;int array[size+1];ARRAY[]={0,12,23,11,55,2,34,18,20,48,22};for (i=2;iArray[0]=array[i];J=i-1;while (Array[0]ARRAY[J+1]=ARRAY[J];j--;}ARRAY[J+1]=ARRAY[0];}}Binary Insert Sortvoid

Shell sequencing of data structures

#SIZE 10Direct Insert Sortvoid Insert_sort () {int i,j;int array[size+1];ARRAY[]={0,12,23,11,55,2,34,18,20,48,22};for (i=2;iArray[0]=array[i];J=i-1;while (Array[0]ARRAY[J+1]=ARRAY[J];j--;}ARRAY[J+1]=ARRAY[0];}}Binary Insert Sortvoid

Total Pages: 541 1 .... 523 524 525 526 527 .... 541 Go to: GO

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.