Results 1 to 6 of 6
i have a script gdrGltoDataRefresh.sh .while try to run the script it's giving
insufficient arguments -- 0
Usage: gdrGltoDataRefresh.sh export_instance import_instance
where
export_instance - instance where the data is being ...
- 03-24-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 4
insufficient arguments while running a script
i have a script gdrGltoDataRefresh.sh .while try to run the script it's giving
insufficient arguments -- 0
Usage: gdrGltoDataRefresh.sh export_instance import_instance
where
export_instance - instance where the data is being copied FROM
import_instance - instance where the data is being copied TO
refresh_env - env for import_instance, itl/preprod
and in log file it's giving
required argument directory not specified
Usage: gfPurgeFilesByAge [-r] -d directory -f filePattern -p daysOld
can somebody help me .it's urgent and i am new to linux
- 03-24-2010 #2
it would be helpful if you showed how you executed the script and the code of the script as well if possible
- 03-24-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 4
Thanks for the reply.i have run script using sh scriptname.say sh gdrGltoDatarefresh.sh. i want to know the root cause of this problem.and here is the code
Code:#!/usr/bin/ksh ######################################################################## # # Name - gdrGltoDataRefresh.sh # # Description - This script copies data from Prod to PreProd. # # Arguments - see usage function # # Restart - script can be restarted from the top from any point of # failure # ######################################################################## # MODIFICATION HISTORY # Version Date Author Description # 1.0 2005-04-29 B. Logan * First version. # 1.1 2005-05-24 B. Logan * Updated backup export to # use multiple dmp files. # OSR30600 # 1.2 2005-06-09 B. Logan * Added code to disable/ # enable trigger. Added call # to glto_load.ksh for USBP. # 1.3 2005-06-28 B. Logan * Fixed code that resets SID # OSR32007 # 1.4 2007-04-22 Mohamed Sulaiman * Added functionality to send email # after successful run of this script # and added functionality to count the # records before export and after import # RFC75312 ######################################################################## thisCode="$(basename "${0}")" thisScript="${thisCode}" trap 'efErrorTrap "${thisCode}" "$LINENO"' ERR ######################################################################## # External function Section # Note: gfGenericFunctions.sh sources efErrorFunctions.sh # efErrorFunctions.sh sources nfNotifyFunctions.sh ######################################################################## echo "Value of Dir Name in DATAREFRESH file is $(dirname ${0})" . $(dirname ${0})/gfGenericFunctions.sh . $(dirname ${0})/ofOracleFunctions.sh ######################################################################## # Internal function Section ######################################################################## function usage { #----------------------------------------------------------------------- # Display usage syntax #----------------------------------------------------------------------- gfStdErr "\ Usage: ${thisScript} export_instance import_instance where export_instance - instance where the data is being copied FROM import_instance - instance where the data is being copied TO refresh_env - env for import_instance, itl/preprod " sleep 1 # Allows logger to catch up before shell prints the prompt } function validateArguments { #----------------------------------------------------------------------- # Validate command line options and arguments #----------------------------------------------------------------------- typeset thisCode=validateArguments trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR #----------------------------------------------------------------------- # Option defaults #----------------------------------------------------------------------- # No options at this time #----------------------------------------------------------------------- # Parse options (first colon tells getopts to be silent on option errors # because the case statement will handle errors. Other colons follow # option letters that require an additional argument) #----------------------------------------------------------------------- while getopts : optLetter do case ${optLetter} in :) gfStdErr "${thisScript}: Error 0006: option requires an argument -- ${OPTARG}" usage exit 3 ;; *) if [ "${OPTARG}" = "?" ] then usage exit 1 else gfStdErr "${thisScript}: Error 0007: illegal option -- ${OPTARG}" usage exit 3 fi ;; esac done #----------------------------------------------------------------------- # Eat the options we've found and processed from ${*} #----------------------------------------------------------------------- shift $((${OPTIND} - 1)) #----------------------------------------------------------------------- # Validate Arguments #----------------------------------------------------------------------- case ${#} in 0) gfStdErr "${thisScript}: Error 0003: insufficient arguments -- ${#}" usage exit 3 ;; 1) gfStdErr "${thisScript}: Error 0003: insufficient arguments -- ${#}" usage exit 3 ;; 2) gfStdErr "${thisScript}: Error 0003: insufficient arguments -- ${#}" usage exit 3 ;; 3) ORACLE_SID=${1} gdrExportInstance=${1} gdrImportInstance=${2} gdrEnv=${3} ;; *) gfStdErr "${thisScript}: Error 0004: excessive arguments -- ${#}" usage exit 3 ;; esac #----------------------------------------------------------------------- # Validate output directory #----------------------------------------------------------------------- outputDirectory=${gfBaseDir}/output if [ -d "${outputDirectory}" ] then cd ${outputDirectory} else gfStdErr "${thisScript}: Error 0001: script output directory ${outputDirectory} not setup" usage exit 3 fi #----------------------------------------------------------------------- # Move remaining arguments into ${args} #----------------------------------------------------------------------- args=${*} } function getConfig { #----------------------------------------------------------------------- # get login variables from configuration file #----------------------------------------------------------------------- typeset thisCode=getConfig trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR configFile=${gfBaseDir}/data/gdrGltoDataRefreshConfig.sh if [ -s "${configFile}" ] then . ${configFile} #----------------------------------------------------------------------- # OF_ variables are used by ofOracleFunctions.sh #----------------------------------------------------------------------- OF_USERNAME=${gdrExportUsername} OF_PASSWORD=${gdrExportPassword} OF_SERVICE=${ORACLE_SID} OF_CONNECT_AS=NONE else efAbnormalExit "${thisCode}" "${LINENO}" \ "Error 0002: Login file ${configFile} not found or is empty" fi } function doRefreshExport { #----------------------------------------------------------------------- # export the tables from the exportInstance #----------------------------------------------------------------------- typeset thisCode=doRefreshExport trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data #----------------------------------------------------------------------- # see if gdrGltoDataRefreshExport.pipe exists and is a named pipe, otherwise remove # it and recreate as a pipe. #----------------------------------------------------------------------- if [ -p gdrGltoDataRefreshExport.pipe ] then : else #----------------------------------------------------------------------- # The -f flag is important because it causes rm to still give a zero # exit code if the file doesn't exist. A non-zero exit code would # trigger the trap handler otherwise. #----------------------------------------------------------------------- rm -f gdrGltoDataRefreshExport.pipe mkfifo gdrGltoDataRefreshExport.pipe fi rm -f gdrGltoDataRefreshDynamic.par cat ${gfBaseDir}/data/gdrGltoDataRefresh.par > gdrGltoDataRefreshDynamic.par echo "tables=${gdrTable}" >> gdrGltoDataRefreshDynamic.par if [ "${gdrQuery}" = "" ] then : else echo "query=\"${gdrQuery}\"" >> gdrGltoDataRefreshDynamic.par fi #compress < gdrGltoDataRefreshExport.pipe > gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.dmp.Z & gzip < gdrGltoDataRefreshExport.pipe > gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.dmp.gz & gfStdOut "${OF_USERNAME}/${OF_PASSWORD}@${gdrExportInstance}"|exp \ PARFILE=gdrGltoDataRefreshDynamic.par \ FILE=gdrGltoDataRefreshExport.pipe \ LOG=${gfBaseDir}/output/gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.log rm -f gdrGltoDataRefreshExport.pipe if [ $(tail -1 ${gfBaseDir}/output/gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.log | \ egrep -c "Export terminated successfully without warnings.") -ne 1 ] then efAbnormalExit "${thisCode}" "${LINENO}" \ "Error 0101: Refresh Data ${gdrExportInstance} ${gdrTable} Export Failed" fi gfStdOut "$(gfVisualTimestamp) - ${gdrExportInstance} ${gdrTable} Export Completed" } #----------------------------------------------------------------------- # The following doBackupExport code is commented by Mohamed Akbar Sulaiman # as part of version 1.4 starts this method is replaced with doBackupPPRODExport #----------------------------------------------------------------------- #function doBackupExport { #----------------------------------------------------------------------- # backup the tables from the importInstance #----------------------------------------------------------------------- # typeset thisCode=doBackupExport # trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR # # cd ${gfBaseDir}/data # #----------------------------------------------------------------------- # see if gdrGltoDataRefreshExport.pipe exists and is a named pipe, otherwise remove # it and recreate as a pipe. #----------------------------------------------------------------------- # if [ -p gdrGltoDataRefreshExport1.pipe ] # then # : # else #----------------------------------------------------------------------- # The -f flag is important because it causes rm to still give a zero # exit code if the file doesn't exist. A non-zero exit code would # trigger the trap handler otherwise. #----------------------------------------------------------------------- # rm -f gdrGltoDataRefreshExport1.pipe # mkfifo gdrGltoDataRefreshExport1.pipe # fi # # if [ -p gdrGltoDataRefreshExport2.pipe ] # then # : # else # rm -f gdrGltoDataRefreshExport2.pipe # mkfifo gdrGltoDataRefreshExport2.pipe # fi # # if [ -p gdrGltoDataRefreshExport3.pipe ] # then # : # else # rm -f gdrGltoDataRefreshExport3.pipe # mkfifo gdrGltoDataRefreshExport3.pipe # fi # # compress < gdrGltoDataRefreshExport1.pipe > gdrGltoDataRefreshExpBackup1.${gdrImportInstance}.dmp.Z & # gdrCompress1Pid=${!} # # compress < gdrGltoDataRefreshExport2.pipe > gdrGltoDataRefreshExpBackup2.${gdrImportInstance}.dmp.Z & # gdrCompress2Pid=${!} # # compress < gdrGltoDataRefreshExport3.pipe > gdrGltoDataRefreshExpBackup3.${gdrImportInstance}.dmp.Z & # gdrCompress3Pid=${!} # # gfStdOut "${OF_USERNAME}/${OF_PASSWORD}@${gdrImportInstance}"|exp \ # PARFILE=${gfBaseDir}/data/gdrGltoDataRefreshBackup.par \ # FILE=gdrGltoDataRefreshExport1.pipe,gdrGltoDataRefreshExport2.pipe,gdrGltoDataRefreshExport3.pipe \ # LOG=${gfBaseDir}/output/gdrGltoDataRefreshExpBackup.${gdrImportInstance}.log # #----------------------------------------------------------------------- # Check each compress process and see if it's still running. Copy # null to it if it is. This prevents orphan processes. #----------------------------------------------------------------------- # if [ "$(ps -p ${gdrCompress1Pid} -o args|grep "gdrGltoDataRefresh"|wc -l)" -gt 0 ] # then # echo "" > gdrGltoDataRefreshExport1.pipe # fi # # if [ "$(ps -p ${gdrCompress2Pid} -o args|grep "gdrGltoDataRefresh"|wc -l)" -gt 0 ] # then # echo "" > gdrGltoDataRefreshExport2.pipe # fi # # if [ "$(ps -p ${gdrCompress3Pid} -o args|grep "gdrGltoDataRefresh"|wc -l)" -gt 0 ] # then # echo "" > gdrGltoDataRefreshExport3.pipe # fi # # rm -f gdrGltoDataRefreshExport1.pipe # rm -f gdrGltoDataRefreshExport2.pipe # rm -f gdrGltoDataRefreshExport3.pipe # # if [ $(tail -1 ${gfBaseDir}/output/gdrGltoDataRefreshExpBackup.${gdrImportInstance}.log | \ # egrep -c "Export terminated successfully without warnings.") -ne 1 ] # then # efAbnormalExit "${thisCode}" "${LINENO}" \ # "Error 0102: Backup Data ${gdrImportInstance} Export Failed" # fi # # gfStdOut "$(gfVisualTimestamp) - Backup Data Export Completed" #} ############################################################################################## #----------------------------------------------------------------------- # The following doBackupPPRODExport code is written by Mohamed Akbar Sulaiman # to do backup the PPROD tables before import is happen # as part of version 1.4 starts here #----------------------------------------------------------------------- function doBackupPPRODExport { #----------------------------------------------------------------------- # backup the tables from the importInstance #----------------------------------------------------------------------- typeset thisCode=doBackupPPRODExport trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data #----------------------------------------------------------------------- # see if gdrGltoDataRefreshExport1.pipe exists and is a named pipe, otherwise remove # it and recreate as a pipe. #----------------------------------------------------------------------- if [ -p gdrGltoDataRefreshExport1.pipe ] then : else #----------------------------------------------------------------------- # The -f flag is important because it causes rm to still give a zero # exit code if the file doesn't exist. A non-zero exit code would # trigger the trap handler otherwise. #----------------------------------------------------------------------- rm -f gdrGltoDataRefreshExport1.pipe mkfifo gdrGltoDataRefreshExport1.pipe fi rm -f gdrGltoDataRefreshDynamic.par cat ${gfBaseDir}/data/gdrGltoDataRefresh.par > gdrGltoDataRefreshDynamic.par echo "tables=${gdrTable}" >> gdrGltoDataRefreshDynamic.par if [ "${gdrQuery}" = "" ] then : else echo "query=\"${gdrQuery}\"" >> gdrGltoDataRefreshDynamic.par fi gzip < gdrGltoDataRefreshExport1.pipe > gdrGltoDataRefreshExpBackup1.${gdrImportInstance}.${gdrTable}.dmp.gz & gfStdOut "${OF_USERNAME}/${OF_PASSWORD}@${gdrImportInstance}"|exp \ PARFILE=gdrGltoDataRefreshDynamic.par \ FILE=gdrGltoDataRefreshExport1.pipe \ LOG=${gfBaseDir}/output/gdrGltoDataRefreshExpBackup1.${gdrImportInstance}.${gdrTable}.log rm -f gdrGltoDataRefreshExport1.pipe if [ $(tail -1 ${gfBaseDir}/output/gdrGltoDataRefreshExpBackup1.${gdrImportInstance}.${gdrTable}.log | \ egrep -c "Export terminated successfully without warnings.") -ne 1 ] then efAbnormalExit "${thisCode}" "${LINENO}" \ "Error 0101: Refresh Data ${gdrImportInstance} ${gdrTable} Export Failed" fi gfStdOut "$(gfVisualTimestamp) - ${gdrImportInstance} ${gdrTable} Back up Export Completed" } function runDelete { #----------------------------------------------------------------------- # Run Delete SQL script using common oracle function #----------------------------------------------------------------------- typeset thisCode=runDelete trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data ofExecSqlScript ${gfBaseDir}/sql/gdrGltoDataRefreshDelete.sql gfStdOut "$(gfVisualTimestamp) - Delete Completed" } function runUpdateTrigger { #----------------------------------------------------------------------- # Run SQL script to either enable or disable trigger #----------------------------------------------------------------------- typeset thisCode=runUpdateTrigger trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data ofExecSqlScript ${gfBaseDir}/sql/${gdrTriggerScript} gfStdOut "$(gfVisualTimestamp) - Trigger Updated" } #----------------------------------------------------------------------- # runRecordCount written by Mohamed Akbar Sulaiman as part of version 1.4 starts here #----------------------------------------------------------------------- function runRecordCount { #----------------------------------------------------------------------- # Run SQL script to count the records before export and after import #----------------------------------------------------------------------- typeset runRecordCount trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data ofExecSqlScript ${gfBaseDir}/sql/${gdrRecordCountScript} gfStdOut "$(gfVisualTimestamp) - Records counted" } #----------------------------------------------------------------------- # runRecordCount written by Mohamed Akbar Sulaiman as part of version 1.4 ends here #----------------------------------------------------------------------- function doRefreshImport { #----------------------------------------------------------------------- # import the data into the importInstance #----------------------------------------------------------------------- typeset thisCode=doRefreshImport trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data #----------------------------------------------------------------------- # see if gdrGltoDataRefreshImport.pipe exists and is a named pipe, otherwise remove # it and recreate as a pipe. #----------------------------------------------------------------------- if [ -p gdrGltoDataRefreshImport.pipe ] then : else #----------------------------------------------------------------------- # The -f flag is important because it causes rm to still give a zero # exit code if the file doesn't exist. A non-zero exit code would # trigger the trap handler otherwise. #----------------------------------------------------------------------- rm -f gdrGltoDataRefreshImport.pipe mkfifo gdrGltoDataRefreshImport.pipe fi #uncompress < gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.dmp.Z > gdrGltoDataRefreshImport.pipe & gunzip < gdrGltoDataRefreshExport.${gdrExportInstance}.${gdrTable}.dmp.gz > gdrGltoDataRefreshImport.pipe & gfStdOut "${OF_USERNAME}/${OF_PASSWORD}@${gdrImportInstance}"|imp \ FILE=gdrGltoDataRefreshImport.pipe \ fromuser=${gdrTableOwner} touser=${gdrTableOwner} \ commit=Y ignore=y \ LOG=${gfBaseDir}/output/gdrGltoDataRefreshImport.${gdrImportInstance}.${gdrTable}.log rm -f gdrGltoDataRefreshImport.pipe if [ $(tail -1 ${gfBaseDir}/output/gdrGltoDataRefreshImport.${gdrImportInstance}.${gdrTable}.log | \ egrep -c "Import terminated successfully without warnings" ) -ne 1 ] && \ [ $(tail -1 ${gfBaseDir}/output/gdrGltoDataRefreshImport.${gdrImportInstance}.${gdrTable}.log | \ egrep -c "Import terminated successfully with warnings") -ne 1 ] then efAbnormalExit "${thisCode}" "${LINENO}" \ "Error 0103: Refresh Data ${gdrExportInstance} ${gdrTable} Import Failed" fi gfStdOut "$(gfVisualTimestamp) - ${gdrImportInstance} ${gdrTable} Import Completed" } function runUpdate { #----------------------------------------------------------------------- # Run Update SQL script using common oracle function #----------------------------------------------------------------------- typeset thisCode=runUpdate trap 'efErrorTrap "${thisCode}" "${LINENO}"' ERR cd ${gfBaseDir}/data OF_USERNAME=${gdrUpdateUsername} OF_PASSWORD=${gdrUpdatePassword} ofExecSqlScript ${gfBaseDir}/sql/gdrGltoDataRefreshUpdateGmdida.sql gfStdOut "$(gfVisualTimestamp) - Update Completed" } ######################################################################## # Mainline Section ######################################################################## #----------------------------------------------------------------------- # This function call calculates the support home directory from where # this script is installed. Examples: # # Script directory gfBaseDir # /home/usnrtstr/glto/prod/scripts /home/usnrtstr/glto/prod #----------------------------------------------------------------------- gfBaseDir=$(gfBaseDir) efMessageHelpFile="${gfBaseDir}/doc/gdrGltoDataRefreshHelp.txt" efMessageSeverity="Sev2" #----------------------------------------------------------------------- # Validate arguments (error here will go to terminal or cron id mailbox) #----------------------------------------------------------------------- validateArguments ${*} #----------------------------------------------------------------------- # Log stdout and stderr to file, -p is purge days # This script only runs twice a month so 60 days should keep about 2 # months worth #----------------------------------------------------------------------- gfScriptLogger -p 60 #----------------------------------------------------------------------- # Don't allow more than one job running at a time #----------------------------------------------------------------------- gfCheckRunning #----------------------------------------------------------------------- # Run only every OTHER week #----------------------------------------------------------------------- isItThere="$(find ${gfBaseDir}/data/gdrGltoDataRefresh.sh.lastRun.txt -mtime -8)" if [ "${isItThere}" = "" ] then touch ${gfBaseDir}/data/gdrGltoDataRefresh.sh.lastRun.txt else gfStdOut "$(gfVisualTimestamp) - Job ran last week - Do not run this week" exit 0 fi #----------------------------------------------------------------------- # Setup Oracle environment # (ORACLE_HOME, LD_LIBRARY_PATH, PATH, and ORACLE_PATH) #----------------------------------------------------------------------- ofOracleEnvironment #----------------------------------------------------------------------- # get login credentials #----------------------------------------------------------------------- getConfig #----------------------------------------------------------------------- # Set NLS_LANG from database using login credentials #----------------------------------------------------------------------- ofNlsLang #----------------------------------------------------------------------- # runRecordCount to count the record before export as part of version 1.4 #----------------------------------------------------------------------- gdrRecordCountScript='gdrGltoDataRecordCount.sql' runRecordCount #----------------------------------------------------------------------- # do refresh export from exportInstance #----------------------------------------------------------------------- grep -v '^#' ${gfBaseDir}/data/gdrGltoDataRefreshExportData.txt|while read line do gdrTable=$(echo ${line} | awk -F^ '{print $1}' -) gdrQuery=$(echo ${line} | awk -F^ '{print $2}' -) doRefreshExport done #----------------------------------------------------------------------- # The following code is written by Mohamed Akbar Sulaiman # to send email alert after successful DB refresh is # completed as part of version 1.4 starts here #----------------------------------------------------------------------- gfStdOut "$(gfVisualTimestamp) - GLTO Data Export from PROD Completed" #----------------------------------------------------------------------- # Reset Oracle values to importInstance #----------------------------------------------------------------------- ORACLE_SID=${gdrImportInstance} OF_USERNAME=${gdrImportUsername} OF_PASSWORD=${gdrImportPassword} OF_SERVICE=${ORACLE_SID} ofOracleEnvironment ofNlsLang #----------------------------------------------------------------------- # do backup export from importInstance #----------------------------------------------------------------------- #----------------------------------------------------------------------- # following doBackupExport is repalced with doBackupPPRODExport as part # of version 1.4. #----------------------------------------------------------------------- #doBackupExport #----------------------------------------------------------------------- #----------------------------------------------------------------------- # The following code is written by Mohamed Akbar Sulaiman # to do backup the PPROD tables before import is happen # as part of version 1.4 starts here #----------------------------------------------------------------------- #----------------------------------------------------------------------- # do backup export from importInstance #----------------------------------------------------------------------- grep -v '^#' ${gfBaseDir}/data/gdrGltoDataRefreshExportData.txt|while read line do gdrTable=$(echo ${line} | awk -F^ '{print $1}' -) gdrQuery=$(echo ${line} | awk -F^ '{print $2}' -) doBackupPPRODExport done #----------------------------------------------------------------------- # The following code is written by Mohamed Akbar Sulaiman # to send email alert after successful DB refresh is # completed as part of version 1.4 starts here #----------------------------------------------------------------------- gfStdOut "$(gfVisualTimestamp) - Backup export from PPROD Completed" #----------------------------------------------------------------------- # Disable Triggers #----------------------------------------------------------------------- gdrTriggerScript='gdrGltoDataRefreshDisableTrigger.sql' runUpdateTrigger #----------------------------------------------------------------------- # do deletes from importInstance #----------------------------------------------------------------------- runDelete #----------------------------------------------------------------------- # do Import into importInstance #----------------------------------------------------------------------- grep -v '^#' ${gfBaseDir}/data/gdrGltoDataRefreshExportData.txt|while read line do gdrTable=$(echo ${line} | awk -F^ '{print $1}' -) gdrTableOwner=$(echo ${line} | awk -F. '{print $1}' -) doRefreshImport done #----------------------------------------------------------------------- # Enable Trigger #----------------------------------------------------------------------- gdrTriggerScript='gdrGltoDataRefreshEnableTrigger.sql' runUpdateTrigger #----------------------------------------------------------------------- # do updates on importInstance #----------------------------------------------------------------------- runUpdate #----------------------------------------------------------------------- # runRecordCount to count the record after import as part of version 1.4 #----------------------------------------------------------------------- OF_USERNAME=${gdrImportUsername} OF_PASSWORD=${gdrImportPassword} gdrRecordCountScript='gdrGltoDataRecordCount.sql' runRecordCount gfStdOut "$(gfVisualTimestamp) - GLTO Data load successful" #----------------------------------------------------------------------- # Call script to update USBP BABF_USG data #----------------------------------------------------------------------- #/cronglto/glto/${gdrEnv}/bin/glto_load.ksh ${gdrEnv} #----------------------------------------------------------------------- # End program #----------------------------------------------------------------------- gfStdOut "$(gfVisualTimestamp) - GLTO Data Refresh Completed" #----------------------------------------------------------------------- # The following code is written by Mohamed Akbar Sulaiman # to send email alert after successful DB refresh is # completed as part of version 1.4 starts here #----------------------------------------------------------------------- efMessageSeverity="Info" efMessageSubject="GLTO Data Refresh Completed - $(gfVisualTimestamp)" gfBaseDir=$(gfBaseDir) efMessageHelpFile="${gfBaseDir}/doc/gdrGltoDataRefreshHelp.txt" nfSendMessage -v "${efMessageSeverity}" -s "${efMessageSubject}" \ -f "${efMessageBody}" -h "${efMessageHelpFile}" exit 0Last edited by Cabhan; 03-24-2010 at 10:32 PM. Reason: Wrapping script in code blocks...
- 03-24-2010 #4
The problem seems fairly obvious to me...
You're running the code this way:
However, the code expects to be run with three arguments: an "export instance", an "import instance", and a "refresh environment". I don't know what these mean, but you have to run the script this way:Code:sh gdrGltoDatarefresh.sh
That is, you need to put the three arguments on the commandline after the name of the script.Code:sh gdrGltoDatarefresh.sh <export instance> <import instance> <refresh environment>
DISTRO=Arch
Registered Linux User #388732
- 03-24-2010 #5Just Joined!
- Join Date
- Mar 2010
- Posts
- 4
Thanks for the reply.but it was scheduled in crontab like this.
00 03 4-10,18-24 * * test `date +/%a` = Sun && /cronglto/glto/preprod/common/scripts/gdrGltoDataRefresh.sh glgl2p glgl2r preprod
in log file it's giving this error:
[gm1@localhost scripts]$ sh gdrGltoDataRefresh.sh glgl2p glgl2r preprod
Value of Dir Name in DATAREFRESH file is .
Value os Dir Name in gfGenericFunctions file is .
Value if Dir Name in efErrorFunctions file is .
Value if Dir Name in efErrorFunctions file is .
[gm1@localhost scripts]$ gfPurgeFilesByAge: required argument directory not specified
Usage: gfPurgeFilesByAge [-r] -d directory -f filePattern -p daysOld
[-c keepCount]
where
-d directory directory in which to purge files
-f filePattern file name pattern of matching files to purge
-p daysOld purge files older than daysOld
-r adds -r switch to rm command, useful for purging
entire directories
-c keepCount don't delete anything unless more than keepCount
number of files are found
can you help me onthis..
- 03-24-2010 #6Just Joined!
- Join Date
- Mar 2010
- Posts
- 4
function gfPurgeFilesByAge {
#************************************************* **********************
#
# Name - gfPurgeFilesByAge
#
# Description - delete files older than n days
#
# Arguments - see usage function
#
#************************************************* **********************
# MODIFICATION HISTORY
# Version Date Author Description
# 1.0 2004-01-25 V. Poore * First written
# 1.1 2004-10-25 V. Poore * Bug fix on -mtime option
# * Add -c keepCount option
# * Resolve incompatibility
# between HP and Sun find
#************************************************* **********************
typeset thisCode=gfPurgeFilesByAge
trap 'efErrorTrap "${thisCode}" "line unknown"' ERR
function gfpfbaUsage {
#-----------------------------------------------------------------------
# Display usage syntax
#-----------------------------------------------------------------------
gfStdErr "\
Usage: ${thisCode} [-r] -d directory -f filePattern -p daysOld
[-c keepCount]
where
-d directory directory in which to purge files
-f filePattern file name pattern of matching files to purge
-p daysOld purge files older than daysOld
-r adds -r switch to rm command, useful for purging
entire directories
-c keepCount don't delete anything unless more than keepCount
number of files are found
"
}


Reply With Quote