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

Calling shell scripts based on Sparksql to run SQL

[Author]: KwuBased on the Sparksql call shell script run Sql,sparksql provides an option similar to-e,-F,-I in Hive1. Timed Call Script#!/bin/sh # Upload logs to HDFs yesterday= ' date--date= ' 1 days ago ' +%y%m%d

Shell replace and remove line breaks

When we use the shell to process files, we often need to remove or add newline characters, the name of the problem is how to quickly replace it?We have such a file[email protected] working]# cat

Shell Learning Note

Tag:expr   bsp    Command    not   csharp    other   filename    line    awk    Shell Learning notemain= "/usr/local/" # Variable uppercase status= "$MAIN/status" # USD multibyte string is a reference variable value, while USD multibyte number

Shell Programming Notes

#!/bin/bashecho "Hello world!"1. As an executable programSave the above code as test.sh and CD to the appropriate directory:chmod u+./test. #使脚本具有执行权限 ./test. #执行脚本2. As an interpreter parameterThis works by running the interpreter directly, whose

Post a shell script for future reference.

1#! /bin/Bash2 3icms_path=$ (CD $ (dirname$0);pwd)4deploy_path=$ (CD $ (dirname$ICMS _path);pwd)5jar_file= $DEPLOY _path'/dailydata-1.0-snapshot.jar'6ini_file= $DEPLOY _path'/cnedmp_etl.ini'7log_file= $DEPLOY _path'/shellrun.log'8coding='GB2312'9

Shell script Implementation empties log

#!bin/bashLog_dir=/var/logRoot_uid=0if[' $UID '-ne ' $ROOT _uid ']ThenEcho ' must is root to run this srcripts 'Exit 1FiCD $Log_dir | | {echo "Cannot change Necessarydirectroy" >&2Exit 1}Cat/dev/null >messages&&Echo ' log is cleaned up. 'Exit 0 #返回0

Customizing your own Shell logon scripts

Edit the. bash_profile file under your own user#. Bash_profile#exportPs1= "\n\e[1;32m[\e[0;31m\u\e[0;[ Email protected]\e[0;31m\h\e[1;32m]\e[1;32m[\e[0;34m\w\e[1;32m]$ "# Get the aliases and functionsIf [-f ~/.BASHRC]; Then. ~/.bashrcFi# User

Crontab Shell script writes top information to file

The shell script in Crontab writes the top information to the file:Note:1, Top-n 1 for Execution 1 exit (default top is not exited),-D 1 for 1 seconds2, crontab need to add/bin/bash# CRONTAB-E*/5 * * * */bin/bash/usr/local/bin/top.sh# VI

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 script Programming--cut command

CutThe Cut command extracts text columns from a text file or text stream.Cut grammar[[email protected] ~]# cut-d ' The delimiter character '-f fields The PATH variable is as follows[Email protected] ~]# echo

Bash shell-Generic Project Upgrade script

#!/bin/bash################################################################################# Filename:upgrade_ Project.SH# Summary: Project Upgrade Script # LICENSE:GPL # Version:1.0# Author:jet bi# Email:1207501666@qq. com# Date: ./ ,/ ,# Note:

Understanding the Shell (Chapter fifth)

1. Type of shell[Email protected] ~]# ls-l/bin/*sh-rwxr-xr-x. 1 root root 938832 Jul 2013/bin/bashlrwxrwxrwx. 1 root root 4 Oct 2014/bin/csh-tcsh-rwxr-xr-x. 1 root root 109672 Oct 2012/bin/dashlrwxrwxrwx. 1 root root 4 Oct 2014/bin/sh-bash-rwxr-xr-x.

shell--3, Shell Pass parameters

We can pass parameters to the script when executing the Shell script, and the format of the parameters obtained in the script is:$n. n represents a number, 1 is the first argument to execute the script, 2 is the second argument to execute the script,

Process Control statements for shell scripts

One, branch control statements1. If: Fi conditionif condition; ThenActionFi2. If: else.. Fi conditionIf Condition;thenActionElseActionFi3. If: else if: else.. Fi conditionIf Condition;thenActionelse if Condition;thenActionElseActionFiNote: If and

Some shell default variables

Test script as follows, I mainly want to test $0,$1,$2, $n, [email protected],$* default is what?#!/bin/shEcho ' $1= ' $Echo ' $2= ' $Echo ' [email protected]= ' [email protected]Echo ' $*= ' $*Echo ' $0= 'Test:# sh var.sh 1 2$1=1$2=2[Email

Match shell variable characters in awk

Problem: Now there are two scripts, I want to match the contents of File1 by File2[email protected] home]# cat file13-1-1 potv=1,pota=0,potp=21-4-76 potv=1,pota=0,potp=12-1-2 potv=1,pota=1,potp= 13-1-4 potv=1,pota=1,potp=24-1-5 potv=1,pota=1,potp=27-

Cloud--hbase Shell

The specific HBase shell commands are shown in table 1.1-1 below:Below we will use the example of "A Student score table" to detail the commonly used HBase commands and how they are used.Here grad for the table is a column, course for the table is a

Shell Cut Command

Meaning: Split the file by column according to the delimiterSyntax format: cut [options] ... [File] ...-C, --characters by character-F,--fields by column-D,--delimiter specifies delimiter, default is tab (\ t)Example: viewing file contents Cat

Shell shortcut keys

Linux Command-line edit shortcut: History displays a list of command histories ↑ (Ctrl+p) Displays the previous command ↓ (Ctrl+N) Displays the next command!num executes the command history list of the num-bar command!! Execute the last command!?

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