Linux file Remote transfer client shell script vs. distributed client time synchronization scripts

Source: Internet
Author: User

#! /bin/bash# transferring code and scripts to the Worker node # change the current working directory CD ${Amazoncrawler_home}#读取worker节点ip列表i=0 whileRead Line1 Do#去除空格 line1= ' echo $line 1 | Sed s/[[:space:]]//g ' #若为空则忽略本行if["$line 1" x = x]; Thencontinue fi #若是注释行 ignore Startchar=${line1:0:1}    if["$startChar" x = "#" x]; Thencontinue fi #存储至worker_ips数组 worker_ips[$i]=$line 1 ((I++)) done<./conf/system/worker# Read Service list I=0 whileRead Line1 Do#去除空格 line1= ' echo $line 1 | Sed s/[[:space:]]//g ' #若为空则忽略本行if["$line 1" x = x]; Thencontinue fi #若是注释行 ignore Startchar=${line1:0:1}    if["$startChar" x = "#" x]; Thencontinue fi #存储至services数组 services[$i]=$line 1 ((I++)) done<./conf/system/servicesworker_ips[0]='59.77.132.28' forWorker_ipinch${worker_ips[*]} DoEcho------------------------------------------echo Copy to${worker_ip}SSH-P A[Email protected]${worker_ip}"(. /etc/profile;mkdir-p ${Amazoncrawler_home}/conf/system) "SCP conf/system/configuration.properties conf/system/chromedriver [Email protected]${worker_ip}:${Amazoncrawler_home}/conf/system forServiceinch${services[*]}         DoSSH-P A[Email protected]${worker_ip}"(. /etc/profile;mkdir-p ${Amazoncrawler_home}/sharedstorage/${Service}) "SCP-R sharedstorage/${Service}/*.jar [Email protected]${worker_ip}:${Amazoncrawler_home}/sharedstorage/${Service}SCP-R sharedstorage/${Service}/*.sh [Email protected]${worker_ip}:${Amazoncrawler_home}/sharedstorage/${Service}Done SCP-R sharedstorage/*.sh [email protected]${worker_ip}:${Amazoncrawler_home}/Sharedstoragedone

Multi-server Sync time

 #  !/bin/bash  #   ip_array= (" 59.77.233.195 "" 59.77.233.197 "" 59.77.233.196 "" 218.193.126.186 "" 218.193.126.188 "" 218.193.126.191 "" 218.193.126.192 ") User  = "Fzuir"  cmd  =" sudo date-s ' 2016-9-24 16:34:00 ' " = "#   scripts for remote server execution locally via SSH  Span style= "color: #0000ff;" >for  IP in ${ip_array[* do   ssh -t-p  $port   $user  @ $ip   $cmd  done  

Linux file Remote transfer client shell script vs. distributed client time synchronization 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.