#!/bin/bash#back_mysql by 2016-11-14bak_dir=/data/backup_db/' Date +%y%m%d 'Mysqldb=mysqlmysqluser=*****mysqlpw=******If [$UID-ne 0];thenecho "must to being use as root for exec shell"ExitFi#判断是否存在文件, \033[32m is the color of the displayif [!-D $bak
TemplateCat delbak.sh#!/bin/shlocation= "/root/sqlbak/"Find $location-mtime +30-type f |xargs rm-fPs:Location is the directory where the lookup is set--mtime +30 is set time is 30 days ago-type F this week the type of lookup is fileThen add crontab
The original script check.sh:Monfile= "/var/log/test/testmon.txt"Logfile= "/var/log/test/testmon.log"Touch $monfile...The script is edited in window and uploaded to Linux after editing.Problem:After running, the file that appears in the directory is
1. Read basic reading 1 #!/bin/bash 2 #testing the Read command 3 4 Echo " Enter you name: " 5 Read name # 6echo"Hello $name, Welcome to my program. " Perform:#./read. SH Enter
Regular Expression - concept: A special syntax for describing text patterns -by ordinary characters (e.g., characters A to Z), and special characters (metacharacters, such as/ *?). And so on) make up a matching string--the text Filter tool supports
Questions1. How random numbers are obtained2. How to determine the size of the random value is what we needAnswers1. Can now be obtained by obtaining the number of milliseconds of the system time, after all, the number of milliseconds changes
Explain:begin{} The most common use of this particular pattern is variable assignment. Begin this pattern is when the file does not begin to read.awk ' begin{fs= ': "; ofs="-"}{nf+=0}1", corresponding processing is 1:2:3---------> read the input
1. Change the suffix ". sh" suffix to ". Shell" under the/OPT directory (including subdirectories)2. Renaming files A1, A2, A3 files in directories A, B and C to A4, A5, A63. How to change the AA string in the file to BB in the VI
Case One• Write a login welcome script for ROOT to report the number of processes in the current host, the number of logged-in users, and the disk usage of the root file system.1. Using the VIM command in the /root directory is a new script file
Middle BracketBrackets are divided into single brackets [], and double brackets [[]], and brackets are commonly used in expression judgments, and parentheses can also be used in expressions, as mentioned later.Single brackets []a=5b=3[$A-eq $B]
1. Know CronCron is a timed execution tool under Linux that can run a job without human intervention. Since Cron is a built-in service for Linux, it does not automatically get up, and you can start and shut down this service in the following
Title: Numerical N accumulates to M (nIn the following example, the examples are 1 to 100, and they can be brought into N and M (nFor loop implementationSum=0for ((i=1;iBy using variable arithmetic to implementEcho $[$ (Echo +{1..100})]echo $ (($
grep formatgrep [Options] [mode] [file ...]-C outputs only the number of matching rows-n Lists all matching rows and displays line numbers-V Displays all lines that do not contain matching text-R Recursive Search-E supports extended regular
Recently encountered a problem,Execute script, script calls a command, command (Deamon) is a daemon, in order to debug, the daemon mode is canceled. The other commands behind the command (echo "456") cannot be executed.Deamon-d is initiated in
Shell && and | |When the shell executes a command, it returns a return value that is saved in the shell variable $? In When $? = = 0 o'clock, indicating successful execution; = = 1 o'clock, which indicates that the execution failed.Sometimes the
KVM One-click Shell automatically generates a Windows virtual machine, unattended operation scheme is divided into four steps to complete the joint;The first step: Start the startup script, so that the machine can be executed at the start of the
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