Linux distribution synchronization scripts and distribution command scripts

Source: Internet
Author: User
Tags parent directory

Synchronization script, in the 5th step to splice the host name of your own configuration

1#!/bin/Bash2#1gets the number of input parameters, if there are no parameters, exit directly3Pcount=$#4 if((pcount==0)); Then5 echo no args;6 exit;7 fi8 9#2Get file nameTenp1=$1 OneFname=$ (basename $p 1) AEcho fname=$fname -  -#3get parent directory to absolute Path thepdir=$ (CD-P $ (dirname $p 1); pwd) -Echo pdir=$pdir -  -#4get the current user name +User=$ (WhoAmI) -  +#5Loops A  for((host=3; host<5; host++)); Do at#echo $pdir/$fname [email protected]${xx} $host: $pdir -Echo---------------Hadoop00$host---------------- -RSYNC-RVL $pdir/$fname [email protected] $host: $pdir -Done

Command Script (note to modify the host name of the stitching)

1#!/bin/Bash2Pcount=$#3 if((pcount==0) ); Then4 echo no args;5 exit;6 fi7 8#echo-------------localhost----------9 [email protected]Ten  for((host=3; host<=4; host++)); Do Oneecho----------Hadoop00$host--------- A SSH hadoop00$host [email protected] -Done

Save the script under/usr/local/bin and you can perform the global scope.

Linux distribution synchronization scripts and distribution command scripts

Related Article

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.