ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 1 | USERNAME=$1 |
| 2 | FILE_TO_TRANSFER=$2 |
| 3 | DEST_HOST=$3 |
| 4 | DEST_DIR=$4 |
| 5 | POST_ACTION=$5 |
| 6 | ssh -l $USERNAME $DEST_HOST "mkdir -p $DEST_DIR" |
| 7 | echo "scp $FILE_TO_TRANSFER $USERNAME@$DEST_HOST:$DEST_DIR/" |
| 8 | scp $FILE_TO_TRANSFER $USERNAME@$DEST_HOST:$DEST_DIR/ |
| 9 | if [ $POST_ACTION == "unpack" ] |
| 10 | then |
| 11 | filename=`echo ${FILE_TO_TRANSFER##*/}` |
| 12 | fileType=`echo ${FILE_TO_TRANSFER##*.}` |
| 13 | if [ $fileType == "tar" ] |
| 14 | then |
| 15 | echo "ssh -l $USERNAME $DEST_HOST cd $DEST_DIR && tar xf $filename" |
| 16 | ssh -l $USERNAME $DEST_HOST "cd $DEST_DIR && tar xf $filename" |
| 17 | else if [ $fileType == "zip" ] |
| 18 | then |
| 19 | echo "ssh -l $USERNAME $DEST_HOST unzip -o -q -d $DEST_DIR $DEST_DIR/$filename" |
| 20 | ssh -l $USERNAME $DEST_HOST "unzip -o -q -d $DEST_DIR $DEST_DIR/$filename" |
ramangrover29@gmail.com | 4ba2152 | 2013-02-27 23:35:42 +0000 | [diff] [blame] | 21 | ssh -l $USERNAME $DEST_HOST "chmod -R 755 $DEST_DIR" |
ramangrover29 | 116eb97 | 2013-02-20 20:47:35 +0000 | [diff] [blame] | 22 | fi |
| 23 | fi |
| 24 | fi |