Common Shell (Backup database, backup site, cut access log)

Back up your Web program#!/bin/bash/bin/tar czf/mnt/backup_website/web_$ (date +%y%m%d_%h%m%s). Gz. tar /mnt/wwwroot/web/mnt/backup_websitefind . -mtime +1"*20[1-9][3-9]*"xargsrm - 0Backing Up the

Shell command Tips--text to weight and maintain the original order

In short, this technique corresponds to a scenario such as the followingAssume that there is text such as the followingccccaaaabbbbddddbbbbccccaaaaIt needs to be re-processed now. This is very easy,sort-u, but suppose I want to keep the text in its

Post a shell for reference

1#! /bin/Bash2deploy_path=$ (CD"$ (dirname"$0")";pwd)3ini_file= $DEPLOY _path'/cnedmp_etl.ini'4 . $INI _file5base_path=$ (CD"$ (dirname"$DEPLOY _path")";pwd)6main_path=$ (CD"$ (dirname"$BASE _path")";pwd)7Currrent_date= 'Date-U +\%y\%m\%d

Encrypt a shell script

Automated maintenance of the system with shell scripts is simple, convenient and portable.But shell scripts are read-write and are likely to leak sensitive information, such as usernames, passwords, paths, IP, and so on.Similarly, sensitive

Shell Script sed tool

Overview of the SED tools (streaming editor)Non-interactive, filter and modify text based on pattern matchingLine by row and output the results to the screencan achieve the output of the text, increase, delete, change, check and other operationsSed

An obscure shell command

1. REDIRECT Symbol> Output redirected to a file or device overwriting the original file>! Output redirected to a file or device forcing overwriting of the original file>> output redirected to a file or device to append the original file2. Standard

Shell Script 1.1

#环境变量Echo $HOSTNAME #主机名Echo $SHELL #目前用的哪个解释器Echo $PATH #命令搜索路径Echo $USER #使用的哪个用户Echo $PWD #当前目录Echo $HOME #家目录是哪个Echo $LOGNAME #哪个用户# positional variablesEchoecho $Echoecho $Echo $* #显示所有位置值Echo $# #显示位置值的总数量echo $$ # Process number PID of the

Linux shell renders data

Input/Output Display on the monitorRedirect to FileStandard file descriptor0 STDIN Standard Input1 STDOUT Standard output2 STDERR standard error redirect error message when you need to develop a file descriptor Ls-al badfile 2> test11111Ls-al

Shell methods for removing spaces and blank lines

First, the method of removing the empty lineSometimes when we process and view files, there are often many empty lines, in order to beauty or need, it is necessary to remove these lines, the method is as follows:1) using the TR commandCopy the Code

Shell Script whitespace specification

Shell Script whitespace specificationPractice, write a script:Pass a user name parameter to the script to determine if the user's user name matches the group name of their base group, and displays the results#!/bin/bash#if! ID $ &>/dev/null;thenecho

Environment Variables-linux command line and Shell script programming encyclopedia

Environment Variables Section:1. View Global variables: printenv/env2. Displays the value of a single environment variable: Echo as Echo $HOME3. Display all environment variables set for a particular process: set4. Setting global variables: Creating

Shell and if-related parameters

[ -a FILE ] FILEtrue if it exists. [ -b FILE ] True if it FILE exists and is a block special file. [ -c FILE ] FILEtrue if a special file is present and is a word. [ -d FILE ] True if it

Shell script to create nginx upstream and location configuration file

#!/bin/SH###################################################### name:create_nginx_conf.SH# VERSION:V1.0# Author: OPS Rookie # Description: Creating Nginx-related Profiles # Create Date: .- --Geneva# Email: ############################################

##*,%%* Problems in the shell

Suppose we define a variable as:File=/dir1/dir2/dir3/my.file.txtDifferent values can be replaced with ${}, respectively:${file#*/}: Remove the first one/And the string to its left:Dir1/dir2/dir3/my.file.txt${file##*/}: Erase the last one/And the

1.Linux variables in the shell

1. Shell Variable TypeThe shell is a dynamic type language (not using explicit data declarations) and weakly typed languages (variable type operations vary according to requirements). The variables in the shell are non-typed (all string types), but

Linux Shell Program Debugging

Linux Shell Program DebuggingThe shell program is debugged by adding relevant debugging options when running the program or by adding related statements to the script, allowing the shell program to display some "debug information" for reference

Shell Special variables: $ A, $#, $*, $@, $?, $$, and command-line arguments

variable names can only contain numbers, letters, and underscores, because some variables that contain other characters have special meanings, and such variables are called special variables. List of special variables

Python3 determine if the process exists in the shell && start && Email notifications

Determine if the process existsdefisrunning (process_name):Try: Process= Len (Os.popen ('PS aux | grep "'+ Process_name +'" | Grep-v grep'). ReadLines ())ifProcess >= 1: returnTrueElse: returnFalseexcept: Print("Check

About shell script functions, arrays, string interception, SVN update release instances

#/bin/bash#功能: The QA service creates a zone profile based on the template and submits it to SVN.Source_path=/data/source_codeSVN_PATH=/CODE/PSM #svn发布目录, push to this directory first, and then update the commitDir=

Array of advanced shell programming

Arrays ArrayVariables: Storing the memory space of a single elementArray: A contiguous memory space that stores multiple elements, which is equivalent to a collection of multiple variables that support sparse formatting, which is a discontinuous

Total Pages: 541 1 .... 346 347 348 349 350 .... 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.