1#! /bin/Bash2 3#/python2292/cnedmp/etlscript/cnedmp_etl_v1.0/Testhis4load_path=$ (CD $ (dirname$0);pwd)5#/python2292/cnedmp/etlscript/cnedmp_etl_v1.06deploy_path=$ (CD $ (dirname$LOAD _path);pwd)7#/python2292/cnedmp/Etlscript8base_path=$ (CD"$ (dirname"$DEPLOY _path")";pwd)9#/python2292/cnedmpTenmain_path=$ (CD"$ (dirname"$BASE _path")";pwd) One Afile_landing= $DEPLOY _path'/file_landing.sh' -load_hdfs= $DEPLOY _path'/load_hdfs.sh' -Load_hive= $DEPLOY _path'/load_hive.sh' theLanding_path= $MAIN _path'/landing/' -jar_file= $DEPLOY _path'/dailydata-1.0-snapshot.jar' -ini_file= $DEPLOY _path'/cnedmp_etl.ini' -log_file= $DEPLOY _path'/shellrun.log' + -coding='GB2312' + A#Funtion forLog at functionlogging () { -logtime=$ (Date+"%y-%m-%d%T") - Echo "$logTime $" - } - - in Source $INI _file - to CD $LOAD _path + RM-R DataSpace - mkdirDataSpace the CD DataSpace *ziplist=$ (Cat$LOAD _path/ziplist.txt) $Logging INFO"Get zip file list $ziplist"Panax Notoginseng forZipnameinch$ziplist - Do theLogging INFO"-------------------handling ZipFile $zipname----------------------------" + CP/home/infra1/jason/datafiles/$zipname. Afoldername=$ (Echo$zipname |awk-F.'{print $}') the Echo$foldername + mkdir$foldername - Unzip-D./$foldername $zipname $ CD $foldername $partition=$foldername -filelist=$ (Cat$LOAD _path/filelist.txt) -Logging INFO"Get file list $filelist" the forFileNameinch$filelist - DoWuyi CP$filename $LANDING _path && logging INFO"$filename copied to $LANDING _path" the Done - CD.. Wu SH$LOAD _path/loading_meta_init_history.SH$partition - SH$LOAD _path/schedule_history.SH$partition About CD $LOAD _path $ RM-R $LOAD _path/DataSpace -Logging INFO"-------------------zipfile $zipname finished----------------------------" - Done
Linux Shell Code