Using the shell to back up sites and databases

bz2

#/bin/bashbackupath=/opt/backup/webpath=/usr/local/apache2/htdocs/Date= ' Date +%y%m%d 'webbakfile=web${date}.tar.bz2dbfile=db${date}.tar.bz2Dbuser= ' Root 'Dbpassword= ' 123 'ftpserver=192.168.1.107Ftptargetpath= ' Ftp/backup 'CD $WebPathPwdTar jcf

Shell Programming Basics while practicing

First, the grammar while [Condition] # when the condition condition is established, loop until the condition is not set to stop doing #执行内容done Second, practice Enter the user input parameters until the user enters "end" to end the loop

Linux shell scripting

Linux shell scripting:1. Program Structure Exercise: Write a script, given a positive integer, to calculate the sum of all digits of this number.For example, if the program is given input 123, it should return 1+2+3=6.2. Program Structure Exercise:

How much does shell command Buffer know about playing the shell?

1. Questions: in the afternoon, a classmate asked such a question: Tail-n +$ (tail-n1/root/tmp/n)-f/root/tmp/ip.txt 2>&1| awk ' argind==1{i=$0;next}{i++;if ($0~/file truncated/) {i=0};p rint "---" I;print i >> "/root/tmp/n"} '/root/tmp/n- Seq

Write your own shell command du

The du command can view the number of tiles occupied by the specified folder, and the following is the code for the C language implementation of the Shell du Directive under Linux (Support-k option):#include #include #include #include #include

Write your own shell command pwd

Idea: (1) get "." The I node number, which is called N (using stat)(2) ChDir. (using ChDir)(3) Find the node with inode number n and get its file name.Repeat the operation until the current directory "." The inode value equals "..." The Inode

Shell background process FG BG wait etc usage

[[email protected] shelltest]# ./forever2.sh 2014  10 month  15 Day   Wednesday   03:36:24 cst2014  10 Month  15   Wednesday  03:36:26 CST^Z     (---NOTE: Ctrl + Z) [1]+  stopped              

Shell Programming Notes

#! /bin/shLook for Shell interpreter/bin/sh is a path#! /usr/bin/pythonJust looking for a Python interpreter.How to run a Linux program:Allow files to run directly with executable permissionsInvoke interpreter to executeUse Source to performThe

Linux Shell $ variable

The execution name of this program $n the nth parameter value of the program, n=1..9$* all parameters of the program, which can be more than 9 parameters. $# the number of parameters for this program $$ the PID of the program (the current process ID

Description of case command in Shell under Linux (regular break, unconditional continuation and conditional continuation)

The case name in the shell under Linux is similar to the switch in C + +, but cases in the shell are more powerful and complex.1, strong mainly reflected in: Shell in case the keyword can be a string type, and each item can contain regular

Apache hadoop2.4.1 filesystem Shell

Overview The file system (FS) shell contains various commands for interacting with HDFS, such as local FS, hftp FS, S3 FS, and other. FS shell. Run the following command: Bin/hdfs dfs Path URI can be used as a parameter for all Fs shells. The URI

Pig is used in shell to load and process files in batches

First, I want to process many documents in a folder in batches. These documents save the data I want to process, because pig is a beginner ,, so I don't know how to load data in batches, and I haven't written it. Your UDF can only load files one by

6 basic specifications and excellent habits of shell script Development

1. Specify the script interpreter at the beginning #! /Bin/sh or #! /Bin/bash 2. Provide the function description, author, version, and other information at the beginning # Description: # Author: # contact: # Last edited: # version: Note: you

Hadoop shell Operation Command

Shell operation command: HDFS path, defined in core-site.xml fs. Default. Name HDFS: // master. hadoop: 9000 master. hadoop namenode Host Name Use/to replace the current absolute path Hadoop FS-ls/View content in the root directory of

Shell tutorial 5-shell Operators

Bash supports many operators, including Arithmetic Operators, Relational operators, boolean operators, string operators, and file test operators. Native Bash does not support simple mathematical operations, but can be implemented using other

Write shell chgrp, chown, chmod by yourself

1. chgrp implementation #include #include void chgrp(char * groupname,char * filename){ struct group * groupinfo = NULL; if((groupinfo = getgrnam(groupname)) == NULL) { printf("groupname does not exist\n"); return; } if(

Shell control statement

Summary of statements in Shell integration: If statement: But the if statement of the Branch: If []; then CMD; Fi If statement for dual Branch: If []; then Cmd1; Else Cmd2; Fi Multi-branch if statement: If []; then Cmd1; Elif []; then Cmd2; Elif [];

Use getopts in Shell

[[Email protected] shell] # Cat getopts. Sh #! /Bin/bash # Date = 2014-09-16 # Is to practice the getopts While getopts "A: BC" Arg (: The preceding variable must follow the parameter) Do Case $ ARG in A) Echo "A's Arg: $ optarg" ;; B) Echo "B" ;; C)

Use shell commands to analyze statistics logs and shell commands to collect statistics logs

Use shell commands to analyze statistics logs and shell commands to collect statistics logs When you need to collect user log information and analyze user behavior, you can use shell to conveniently retrieve a lot of data and place it in excel for

In linux/centos shell scripts, the password is not interactively modified. In centos, the password is not modified.

In linux/centos shell scripts, the password is not interactively modified. In centos, the password is not modified.Today, when I wrote a shell script, I found that the user's password needs to be set and the password is set to interactive. This is

Total Pages: 541 1 .... 275 276 277 278 279 .... 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.