Sunday, August 3, 2014

Scripts to upload multiple files on dropbox.redhat.com and ftp.veritas.com

You may need to upload multiple files multiple time on Redhat (sosreports, spacewalk-debug ) and Veritas (VRTSexplorer) websites to get vendor support. Below scripts will be handy for this purpose.

Script to upload file(s) on dropbox.redaht.com

#!/bin/bash
#set -n
if [ $# -eq 0 ]; then
        echo "Usages: $0 "
        exit 1
else
  # Check if file exist and make file readable, if it is not
  for f in $*
  do
    if [ -f $f ];then
      [ ! -r $f ] && sudo chmod 755 $f || (echo Failed to set 755 permission on $f && exit 1)
    else
      echo $f does not exist
      exit 1
    fi
  done

  # Upload file
  echo "Uploading files $* on dropbox.redhat.coms"

ftp -n <
open dropbox.redhat.com
user anonymous nasimuddin.ansari@company.com
bin
prompt
hash
passive
cd  /incoming
mput $*
bye
EOD
echo "Finish uploading of :"
echo $*|tr ' ' '\n'
exit 0
fi



Script to upload file(s) on ftp.veritas.com

#!/bin/bash
#sh -n
# http://www.symantec.com/docs/TECH66995 - for password - it changes in every 3 months

if nc -zvw2 ftp.veritas.com 21; then
        if [ $# -eq 0 ]; then
            echo "Usages: $0 "
            exit 1
        else
        # Check if file exist and make file readable, if it is not
        for f in $*
        do
          if [ -f $f ];then
            [ ! -r $f ] && sudo chmod 755 $f || (echo Failed to set 755 permission on $f && exit 1)
          else
            echo $f does not exist
            exit 1
          fi
        done

          echo "Uploading files $* on ftp.veritas.com"
          ftp -n <
          open ftp.veritas.com
          user iosupport YHJ8YLJpuUN8cY-t
          bin
          prompt
          hash
          passive
          cd  /incoming
          mput $*
          bye
EOD
          echo "Finish uploading of :"
          echo $*|tr ' ' '\n'
          exit 0
        fi
else
        echo 'ftp.veritas.com is not accessible from this host'
        exit 1
fi

No comments:

Post a Comment