Sponsored Content
Top Forums Shell Programming and Scripting Continue Execution Based On List Post 302885001 by aimy on Thursday 23rd of January 2014 03:05:35 AM
Old 01-23-2014
Java Continue Execution Based On List

Hi all.

I have a script like this
Code:
function check_filesize {
filesize_1="$(ls -la "$1"|awk '{ print $5 }')"
sleep 123
filesize_2="$(ls -la "$1"|awk '{ print $5 }')"
if [ $filesize_1 -eq $filesize_2 ]
then
echo "OK"
else
echo "NOT OK"
sleep 1234
check_filesize $1
fi
}

function check_TR {
chk="$(tail -1 $1|grep TR)"
if [ "$chk" != "" ]
then
recnum="$(echo $chk| sed 's/.*|//')"
else
recnum_tmp="$(wc -l "$1"|awk '{ print $1 }')"
recnum="$(echo $recnum_tmp-1|bc)"
fi
echo $recnum
}

function CMLT_Report {
script="$1"
report="$2"
procedure="$3"
file_dir="$4"
file_size="$(ls -la "$2"|awk '{ print $5 }')"
recnum="$(check_TR $2)"
created="$(ls -la "$2"|awk '{ printf "%s,%02i,%s\n" , $6, $7, $8 }')"
remarks="$5"
frequency="$6"
}

function CMLT_Report_2 {
pattern=$1
script=$2
procedure=$3
folder=$4
frequency=$5
for file in $pattern
do
   check_filesize $file
   CMLT_Report "$script" $file "$procedure" "/dbfs_direct/FS1/cmlrpt/" "$folder" "$frequency"
   sh /dbfs_direct/FS1/MIE/script/CAMELOT_REPORTING_LOG.sql $script $report $procedure $file_dir $file_size $recnum $created $remarks $frequency
done
}

CMLT_Report_2 "TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_*.csv" "10.41.54.62/dbfs_direct/FS1/script/run_custom_t.sh" "SP_RPT_FIN_ACC_CONSOL" "Camelot-Financial" "DAILY"

But I want to extend the script in such a way that only proceed if the $pattern belongs to a list (inside file named list.txt)

For example let's say the list contains
Code:
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130414.csv
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130415.csv
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130416.csv
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130417.csv
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130418.csv

So when reading the file pattern
Code:
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130412.csv - NOT PROCEED
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130413.csv - NOT PROCEED
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130414.csv - Proceed
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130415.csv - Proceed
TM_ICP_EDW_FIN04-ACCOUNT_CONSOL_20130416.csv - Proceed

So where do I start?

Thanks for helping.

Thank you.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

file extension based software execution

Hi Experts, I am working in HP-UX 11.0 workstaion. How can i make a file to be executed with the corresponding software to be invoked or executed. as in Windows. ie., if a file index.html has to be double clicked to invoke the Netscape Navigator. What i have to do to achieve this... (2 Replies)
Discussion started by: anent
2 Replies

2. Shell Programming and Scripting

perl - understand process status and continue the code execution

Hello, I need advice on how to check if started processes are finished in perl, here's explanation : OS is RHEL 4, perl -v = "This is perl, v5.8.0 built for i386-linux-thread-multi" The logic of the script : #!/usr/bin/perl use warnings; $param1 = $ARGV; $param2 = $ARGV; $param3 =... (2 Replies)
Discussion started by: sysgate
2 Replies

3. UNIX for Dummies Questions & Answers

UNIX command to skip any warning messages and continue job execution

Hello All, Good day! This is my first UNIX post. :D Anyways, I would like to seek help from you guys if you know of any UNIX command that will skip a warning message once it is encountered but continue to run the execution. Ok here's the situation in general: An encypted file is sent to... (2 Replies)
Discussion started by: jennah_rekka
2 Replies

4. Shell Programming and Scripting

Automatically Rerun a script based on previous execution output

Hi Experts, I have a shell script called "updatevs" that is scheduled to run at 6.00 am everyday via cronjob. The cronjob will execute this script and output to a log file. The functionality of this script is to read the database and run a set of commands. This script is generally successful... (6 Replies)
Discussion started by: forumthreads
6 Replies

5. Shell Programming and Scripting

Execution problem with sort the file based on contents

My input file: >ali ASSDDGHFHFHJFJHJDSDGSDGSDGSDGSDGSDGSDGDSGDSGSDGDSGSDGSDGDSGSDGGDSG >zzz ASdASDASDSADSADDSADJKHJDSADKLJADKLSAJDLJLKJLDASDDSADd >abu ASDASDFSAFASFSADFASDASDSADSADSADSADSADSADASDASdSADSADSADA >aaa... (2 Replies)
Discussion started by: patrick87
2 Replies

6. Emergency UNIX and Linux Support

invoke one script based on previous script execution

I am database guy and not very good at shell scripts. I am seeking help to sharp my script coding. I have 5 scripts 1. master script. I use this one to call other four scripts to do database work. 2. db_backup_1 and log_backup_1 3. db_backup_2 and log_backup_2 in master script, I want to... (4 Replies)
Discussion started by: duke0001
4 Replies

7. UNIX for Dummies Questions & Answers

Creating a column based list from a string list

I have a string containing fields separated by space Example set sr="Fred Ted Joe Peter Paul Jean Chris Tim Tex" and want to display it in a column format, for example to a maximum of a window of 100 characters And hopefully display some thing like Fred Ted Joe ... (3 Replies)
Discussion started by: kristinu
3 Replies

8. Shell Programming and Scripting

how to continue shell script execution process without control going to pompt?

Hi Friends, Iam invoking another shell script to create B2k_session_id from my shell script.It is properly creating B2k_session_id and after creation control is coming out from the script and going to command prompt.The lines which are after the exectrusteduser.com sh.com are not executing..may... (5 Replies)
Discussion started by: vadlamudy
5 Replies

9. Shell Programming and Scripting

Search files in UNIX based on execution

Hi, I have a UNIX script to fetch all the files for current day. so I am using code-- "files=($(find x.lst -maxdepth 1 -type f -daystart -mtime -1))". But this is not going to work if my job starts at 11 PM and continues till 1AM. In tht case I will loose all files between 11PM to 12AM. Is there... (3 Replies)
Discussion started by: usrrenny
3 Replies

10. Programming

Help needed to Spawn Shell on Python and Continue Execution

def gob(url): print "\n\t Running gobuster on target." params = " -e -s '307,200,204,301,302' -t 20 -u " + url + " >> /tmp/%s/gobuster.txt" % (ip) os.system("xterm -e bash -c "tail -f /tmp/%/gobuster.txt"") for i in bflist: dirbf = "gobuster -w " + i... (3 Replies)
Discussion started by: alvinoo
3 Replies
bup-margin(1)						      General Commands Manual						     bup-margin(1)

NAME
bup-margin - figure out your deduplication safety margin SYNOPSIS
bup margin [options...] DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids. For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by its first 46 bits. The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits, that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits with far fewer objects. If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if you're getting dangerously close to 160 bits. OPTIONS
--predict Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer from the guess. This is potentially useful for tuning an interpolation search algorithm. --ignore-midx don't use .midx files, use only .idx files. This is only really useful when used with --predict. EXAMPLE
$ bup margin Reading indexes: 100.00% (1612581/1612581), done. 40 40 matching prefix bits 1.94 bits per doubling 120 bits (61.86 doublings) remaining 4.19338e+18 times larger is possible Everyone on earth could have 625878182 data sets like yours, all in one repository, and we would expect 1 object collision. $ bup margin --predict PackIdxList: using 1 index. Reading indexes: 100.00% (1612581/1612581), done. 915 of 1612581 (0.057%) SEE ALSO
bup-midx(1), bup-save(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-margin(1)
All times are GMT -4. The time now is 11:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy