cat pushFileToRemoteService.sh
#!/bin/sh
BASEDIR="`dirname $0`" ARG_CNT=$#
if [ $ARG_CNT -lt 3 ]; then echo "please use: $0 dst_ip sshUser path_app-core" echo "eg: $0 1.1.1.1 user /opt/app-core/" exit fi
DST_IP=$1; DST_USER=$2;
if [[ "$3" =~ .*[^/]$ ]]; then DST_ROOT=$3/; else DST_ROOT=$3; fi
cd "$BASEDIR" DIR="`pwd`" cd - > /dev/null
# for files(5): # gearman-client-0.0.1-SNAPSHOT.jar # gearman-common-0.0.1-SNAPSHOT.jar # kettle-core-5.3-SNAPSHOT.jar # kettle-engine-5.3-SNAPSHOT.jar # tools-quartz-0.0.1-SNAPSHOT.jar # PATH01="lib/" FILES01="[^m]*-SNAPSHOT.jar"
# for files(1): # tools-odpsplugin-0.0.1-SNAPSHOT-odpsinput.jar # PATH02="plugins/steps/OdpsInputPlugin/" FILES02="*odpsinput.jar"
# for files(1): # tools-odpsplugin-0.0.1-SNAPSHOT-odpsoutput.jar # PATH03="plugins/steps/OdpsOutputPlugin/" FILES03="*odpsoutput.jar"
# for files(1): # pentaho-big-data-plugin-5.3-SNAPSHOT.jar & # PATH04="plugins/pentaho-big-data-plugin/" FILES04="*-SNAPSHOT.jar"
# for files(1): # pentaho-hdfs-vfs-5.3-SNAPSHOT.jar # PATH05="plugins/pentaho-big-data-plugin/hadoop-configurations/cdh52/lib/" FILES05="*hdfs-vfs-*-SNAPSHOT.jar"
# for files(1): # pentaho-hdfs-vfs-5.3-SNAPSHOT.jar # PATH06="plugins/pentaho-big-data-plugin/hadoop-configurations/hadoop-0.2x/lib/" FILES06="*hdfs-vfs-*-SNAPSHOT.jar"
# for files(1): # pentaho-hdfs-vfs-5.3-SNAPSHOT.jar # PATH07="plugins/pentaho-big-data-plugin/hadoop-configurations/hadoop-2.6/lib/" FILES07="*hdfs-vfs-*-SNAPSHOT.jar"
# muti files scp -r $PATH01$FILES01 $DST_USER@$DST_IP:$DST_ROOT$PATH01
scp -r $PATH02$FILES02 $DST_USER@$DST_IP:$DST_ROOT$PATH02
scp -r $PATH03$FILES03 $DST_USER@$DST_IP:$DST_ROOT$PATH03
scp -r $PATH04$FILES04 $DST_USER@$DST_IP:$DST_ROOT$PATH04
scp -r $PATH05$FILES05 $DST_USER@$DST_IP:$DST_ROOT$PATH05
scp -r $PATH06$FILES06 $DST_USER@$DST_IP:$DST_ROOT$PATH06
scp -r $PATH07$FILES07 $DST_USER@$DST_IP:$DST_ROOT$PATH07
echo " ========================================= " echo " files pushed! please check the dst files! >> "
ls -l $PATH01$FILES01 ls -l $PATH02$FILES02 ls -l $PATH03$FILES03 ls -l $PATH04$FILES04 ls -l $PATH05$FILES05 ls -l $PATH06$FILES06 ls -l $PATH07$FILES07