Shell script automatically backs up the database

#!/bin/bashdb_user= "root" db_passwd= "dddddd" db_name= "Mmmmmm" Cd/db_backupecho "You is in Bakmysql directory Now" Backup_dir= "/db_backup" #时间格式time =$ (date+ "%y+%m+%d") #mysql备份命令mysqldump-u$db_user-p$db_passwd $db _name > "$ backup_dir/$db

Linux Command Application large dictionary-11th Chapter shell programming

11.1 Declare: Show or set shell variables 11.2 Export: Display or set environment variables 11.3 Set: Display and set shell variables 11.4 unset: Deleting a variable or function 11.5 env: Viewing and setting environment variables

Special variables for Linux shell programming

$ A This is the path to the script file itself (relative path)If there is an execution script file under the current directory, you cannot write an absolute path for execution.$# this variable to record the number of input parameters6 is the number

Shell scripts to install the NTP Server service

############################# #Deploy NTP server ########################Echo "start deploy NTP server" Yum Install-y NTPif[!-f/var/log/ntpd.log]; Then Touch/var/log/Ntpd.logfi Chownntp:ntp/var/log/Ntpd.logCat$basepath/package/ntp.conf

Introduction to "shell" Linux shell functions

Linux Shell functions Write in front: function, this word in just the beginning of the classmate looks very tall, in fact, the shell inside the function is very simple, function is actually to reduce the amount of code, so this space may be

Have finished the shell, write a little script to show you

In Linux has been learning for one months, today to write a small script, wrote three different, although simple, but you can see, I wrote the script is ping3 times to see if the host is alive!The first one is ~ ~ for~~ loop because I knocked it

Shell exercises (14)

Exercise 1:Print a line with only one numberRequirements: title, a text document with only a number of lines to print outReference Answer:#!/bin/bash# date:2018 March 16 f=/etc/groupline= ' wc-l $f |awk ' {print $} ' for L in ' seq 1 $line ' do n= '

How shell scripts are executed

method One: Switch toShellthe directory where the script is located (at this time, called the working directory) executesShellScript:Cd/data/shell./hello.shThe./ means to execute hello.sh under the current working directory . If you do not add

Aix escalation: "Shell would time out in seconds" workaround

This article mainly describes the "Aix escalation:" Shell will time out in the seconds "solution", mainly related to Aix escalation: "Shell will time out in the seconds" solution, for the AIX escalation : "Shell will time out in seconds" solution

Shell exercises (11)

Exercise 1:Statistics and summationRequirements: calculates the number of digits that appear in each row in document 1.txt and calculates a total of several numbers in the entire document.Reference Answer:#!/bin/bash# date:2018 March 6 sum=0for i in

Shell Example: generating random integers with $RANDOM

The code is as follows:#!/bin/bash# $RANDOM 在每次调用的时候,返回一个不同的随机整数# 指定的范围是: 0 - 32767 MAXCOUNT=10count=1echoecho "$MAXCOUNT random numbers:"echo "-----------------"while [ "$count" -le $MAXCOUNT ] # 产生 10 ($MAXCOUNT) 个随机整数do number=$RANDOM echo $

Shell script cuts tomcat log files

Transferred from: http://www.cnblogs.com/lishun1005/p/6054816.htmlIn view of debugging Logback and log4j file cutting has not been successful, with the shell to write a script to cut Tomcat under the log file (everyone if you have in Logback or

01:shell Basic Use

1.1Write a login welcome script(1a new script file, welcome.sh, is used to output various monitoring information. [[Email protected]~]#vi/root/welcome.sh#!/bin/bashEcho"Number of open processes: $ (PS aux | wc-l)"Echo"number of logged-in users: $

Shell exercises (eight)

Exercise 1: Monitoring disk usageRequirements: Write a shell script that detects all disk partition usage and inode usage and logs to a log file named after today's date, and notifies you when a partition capacity is found or the Inode usage is

Shell Script View Linux system performance bottlenecks (RPM)

Shell Script View Linux system performance bottlenecks (go to: http://blog.51cto.com/lizhenliang/1687612)[[email protected] ~]# cat show_sys_info.sh #!/bin/bash#os_check () {if [-e/etc/redhat-release]; then redhat= ' cat/etc/redhat-release |cut-d

"Linux" Environment variables and shell configuration & execution

Variables and environment variablesThe shell environment usually has many variables, and the variables can be viewed in the form of echo $VAR or ${var}. The SET command can view all variables in the current environment (including general custom

Full-Library hot backup of shell scripts

#!/bin/bashbackup_dir=/oracle/backuplog_file= $ORACLE _base/admin/$ORACLE _sid/hold_backup_$oracle_sid.logecho   "Backuping cold backup"  > $log _filedata>> $log _filesqlplus -s /  As sysdba > $log _filealter database backup controlfile to   '

Shell Learning Notes

First, Shell discussionSecond, the script execution modeCreate and open a shell scriptVim Hello. SHEdit#!/bin/Bash#-E allows echo to support Shell escape character echo"\e[1;34m First shell script \e[0m"Run#赋予权限, running (common) chmod 755 Hello. SH

Shell programming Exercise-Copy the specified file (keep the directory structure of the file)

1. PurposeCopy all files larger than 1M (customizable) in the/root directory to the/tmp/bakdir (customizable) directory, and you need to keep the directory structure.For example, the/root/reed.file file size is 12M and will be copied to

Application practice of Shell array

Definition of shell array:Method 1: The variable value is assigned to the array variable with a small extension, and each variable value is separated by a space.The syntax is as follows:array= (value1 value2 value3 .... ) #常用Method 2: Enclose the

Total Pages: 541 1 .... 516 517 518 519 520 .... 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.