Shell Scripting Automated Collection

Source: Internet
Author: User
Tags ssh keygen

Remotely copy a file to the specified directory on the specified IP machine:


echo "Copy the file to the $ $ directory!"   "For IP in scp-r" [email protected] $IP: $ echo "SCP $ $ip is: $?" Doneecho "$? Distribution Complete!! "

Remote execution of the specified shell file command on the specified IP machine (requires SSH support) (with parameters):

./ XX

For IP in ssh [email protected] $ip $ A echo "Execute $ $ip is: $?" Doneecho "$? The execution is complete! "

#!/bin/bashcp/opt/tmp/hosts.txt/opt/tmp/hosts.txt.bakecho "$? Copy finish! " Exit 0

#!/bin/bashcat/opt/tmp/ssh.txt >>/root/.ssh/authorized_keysecho "$? Append ssh finish! " Exit 0

#!/bin/bashrm-rf $1echo "$? RM finish! " Exit 0

#!/bin/bashcp/opt/tmp/hadoop-2.5.1.tar.gz/opt/hadoop-2.5.1.tar.gzcp/opt/tmp/hbase-0.98.7-hadoop2-bin.tar.gz/ Opt/hbase-0.98.7-hadoop2-bin.tar.gzecho "$? Copy finish! " Cd/opt/tar xvf Hbase-0.98.7-hadoop2-bin.tar.gzecho "$? Install HBase finish! " Tar xvf hadoop-2.5.1.tar.gzecho "$?" Install Hadoop finish! " Exit 0  

#!/bin/bashmkdir-p/usr/java/cp/opt/tmp/jdk-6u45-linux-x64.bin/usr/java/jdk-6u45-linux-x64.binecho "$? Copy finish! " Cd/usr/java/sh/usr/java/jdk-6u45-linux-x64.binecho "$? Install JDK finish! " Exit 0  

#!/bin/bashssh-keygen-t Dsa-p "-F ~/.ssh/id_dsaecho" $? Set ssh keygen finish! " Exit 0

Shell Scripting Automated Collection

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: 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.