大量匯出informatica object 的shell script,informaticaobject
#!/bin/bash # -----------------------------------------------------------------------# Script Name: inf_impobj.sh# Purpose: To batch export mappings or workflows to xml files # Created by: indifferent_to# Date: 2014-11-26 # ----------------------------------------------------------------------function usage {cat <<EOUUsage: inf_impobj.sh -l <list_file> -d <output_folder> -w/-m/-s/-t <user_name>EOUexit 1}repository="repository name"domain="repository domain"host="informatica server host name"port="informatica server port number"_user_name=_password=_obj_type=mappinglist_file=output_folder=if [ ! -n "$1" ]; thenusageelsewhile truedocase $1 in-l)list_file=$2shift 2;;-d)output_folder=$2shift 2;;-w)_obj_type=workflow_user_name=$2break;;-s)_obj_type="source"_user_name=$2break;;-t)_obj_type="target"_user_name=$2break;;-m)_user_name=$2break;;*)if [ ! -n "$1" ]; thenbreak; usageelse echo "invalid argument $1"; break;usagefi ;;esacdonefipmrep connect -r $repository -h $host -o $port -n $_user_name -s $domainif [ $? -ne 0 ]; thenecho "Can not connect to the informatica repository!"exit 1; firow_count=`cat $list_file|wc -l`success=0fail=0for((row=1;row<=$row_count;row++))doobject_name=`sed -n ${row}'p' $list_file`object_name=`echo $object_name|sed 's/\\r//g'`#pmrep objectexport -n $object_name -o $_obj_type -m -f client_delpdw -s -b -r -u ${output_folder}/${object_name}".xml">>infa_expobj.logpmrep objectexport -n $object_name -o $_obj_type -m -f client_delpdw -b -u ${output_folder}/${object_name}".xml">>infa_expobj.logif [ $? -eq 0 ]; thenlet success=$success+1 echo "${object_name} export successfully!"elselet fail=$fail+1echo "${object_name} fail to export."fi#if [ _obj_type="sourcce" ]; then#new_object_name=`echo $object_name|sed 's/flatfile.//g'`#mv ${output_folder}/${object_name}".xml" ${output_folder}/${new_object_name}".xml"#fidoneecho "$success success;$fail fail"