UNIX Shell script to chec timeout period when collecting files in directory - HELP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX Shell script to chec timeout period when collecting files in directory - HELP
# 1  
Old 03-23-2006
UNIX Shell script to chec timeout period when collecting files in directory - HELP

Hi,

I have a shell script which is to perform a check if all 4 particular type of files exists in a directory.
If ALL 4 files are present within a specific Timeframe, then tar these files and zip it.
If not all 4 files are present in the directory after the specific timeframe, then tar whatever files (those that had matched the regex) and zip them.
If it's within the timeframe all 4 files have not arrived, then the script waits until it has reached the timeframe for any or all of the 4 files to arrive.
The timeframe referred to here is that the arithmetic difference between the current time and the file modification time.

The script I have (BASH) is attached in this posting.

However, this is the problem:
From the script's output, it did not show the process of obtaining the variables i.e. OSS_INSTANCE, OSS_NAME, BSC_VAL, etc, etc ..., for the following 2 files encountered:
1003_oxnn2_BSC48379.2.200603130501.768750
1003_oxnn2_BSC48379.72.200603140501.768761
1003_oxnn2_BSC48379.79.200603140501.768766
The output in Listing 1 is based on the fact it has reached the specified timeframe and all 4 files are in the particular directory. Therefore, it should now tar these 4 files and compress them, in which it did.

Listing 1:
prod-cingtuna\ :/mkl/users/lows >/prodkl/MZ4.0/Cingular/MZ/scripts/NokiaR_RAN-tarNew-2.sh
DATE is Thu Mar 23 20:16:05 SGT 2006
file is 1003_oxnn2_BSC48379.1.200603130501.768754
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.1.200603130501.768754
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603130501
GRP_DAY 23
hrmin 17:15
GRP_HOUR 17
GRP_MIN 15
NUM_FILES now is 1
CDAY is 23
CHOUR is 20
CMINUTE is 16
E_DAYS is 0
E_HOURS is 3
E_MINS is 1
TOTAL_HOURS away is 3
TOTAL_MINUTES is 181
TOTAL_MINUTES exceeds TIMEOUT
FILES MISSING OR YET TO ARRIVE AFTER TIMEOUT
ERROR_TYPE is MISSING_FILES
flogName is NOKIA-RAN.RAN.MISSING_FILES.200603232016.err
-n Inside tarAndZip_file() ...
TAR_FILE_NAME is 1003_oxnn2_BSC48379.200603130501.tar
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.1.200603130501.768754 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.200603130501.tar.gz 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.72.200603140500.768752 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.79.200603140501.768766 1K
gzip: 1003_oxnn2_BSC48379.200603130501.tar.gz already exists; do you wish to overwrite (y or n)? y
ERROR_TYPE is TIMEOUT_EXPIRED
flogName is NOKIA-RAN.RAN.TIMEOUT_EXPIRED.200603232016.err
file is 1003_oxnn2_BSC48379.2.200603130501.768750
file is 1003_oxnn2_BSC48379.72.200603140501.768761
file is 1003_oxnn2_BSC48379.79.200603140501.768766
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.79.200603140501.768766
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603140501
GRP_DAY 23
hrmin 16:24
GRP_HOUR 16
GRP_MIN 24
NUM_FILES now is 2
CDAY is 23
CHOUR is 20
CMINUTE is 16
E_DAYS is 0
E_HOURS is 4
E_MINS is -8
TOTAL_HOURS away is 4
TOTAL_MINUTES is 232
TOTAL_MINUTES exceeds TIMEOUT
FILES MISSING OR YET TO ARRIVE AFTER TIMEOUT
ERROR_TYPE is MISSING_FILES
flogName is NOKIA-RAN.RAN.MISSING_FILES.200603232016.err
cp: 1003_oxnn2_BSC48379.79.200603140501.768766 and /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.79.200603140501.768766 are identical
-n Inside tarAndZip_file() ...
TAR_FILE_NAME is 1003_oxnn2_BSC48379.200603140501.tar
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.1.200603130501.768754 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.200603130501.tar.gz 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.72.200603140500.768752 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.79.200603140501.768766 1K
ERROR_TYPE is TIMEOUT_EXPIRED
flogName is NOKIA-RAN.RAN.TIMEOUT_EXPIRED.200603232016.err
prod-cingtuna\ :/mkl/users/lows >


The output in Listing 2 is to show that all 4 files have arrived, and it's still within the timeframe specified. Therefore, it should also tar all 4 files and zip them - in which it also did.

Listing 2:
prod-cingtuna\ :/mkl/users/lows >/prodkl/MZ4.0/Cingular/MZ/scripts/NokiaR_RAN-tarNew-2.sh:
DATE is Thu Mar 23 20:37:53 SGT 2006
file is 1003_oxnn2_BSC48379.1.200603130501.768754
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.1.200603130501.768754
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603130501
GRP_DAY 23
hrmin 20:35
GRP_HOUR 20
GRP_MIN 35
NUM_FILES now is 1
CDAY is 23
CHOUR is 20
CMINUTE is 37
E_DAYS is 0
E_HOURS is 0
E_MINS is 2
TOTAL_HOURS away is 0
TOTAL_MINUTES is 2
TOTAL_MINUTES below TIMEOUT

file is 1003_oxnn2_BSC48379.2.200603130501.768750
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.2.200603130501.768750
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603130501
GRP_DAY 23
hrmin 20:35
GRP_HOUR 20
GRP_MIN 35
NUM_FILES now is 2
CDAY is 23
CHOUR is 20
CMINUTE is 37
E_DAYS is 0
E_HOURS is 0
E_MINS is 2
TOTAL_HOURS away is 0
TOTAL_MINUTES is 2
TOTAL_MINUTES below TIMEOUT

file is 1003_oxnn2_BSC48379.72.200603140501.768761
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.72.200603140501.768761
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603140501
GRP_DAY 23
hrmin 20:36
GRP_HOUR 20
GRP_MIN 36
NUM_FILES now is 3
CDAY is 23
CHOUR is 20
CMINUTE is 37
E_DAYS is 0
E_HOURS is 0
E_MINS is 1
TOTAL_HOURS away is 0
TOTAL_MINUTES is 1
TOTAL_MINUTES below TIMEOUT

file is 1003_oxnn2_BSC48379.79.200603140501.768766
OSS_INSTANCE 1003
OSS_NAME oxnn2
TMP_VAR BSC48379.79.200603140501.768766
BSC_VAL is BSC48379
NOKIA_BSC_ID is 48379
TIMESTAMP is 200603140501
GRP_DAY 23
hrmin 20:36
GRP_HOUR 20
GRP_MIN 36
NUM_FILES now is 4
CDAY is 23
CHOUR is 20
CMINUTE is 37
E_DAYS is 0
E_HOURS is 0
E_MINS is 1
TOTAL_HOURS away is 0
TOTAL_MINUTES is 1
TOTAL_MINUTES below TIMEOUT
NUM_FILES IN DIR EQUALS NUMBER OF EXPECTED FILES
-n Inside tarAndZip_file() ...
TAR_FILE_NAME is 1003_oxnn2_BSC48379.200603140501.tar
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.1.200603130501.768754 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.72.200603140500.768752 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.79.200603140501.768766 1K
prod-cingtuna\ :/mkl/users/lows >

bash-3.00$ pwd
/tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out
bash-3.00$ ls -l
total 64
-rw-r--r-- 1 lows metrica 351 Mar 23 20:37 1003_oxnn2_BSC48379.200603140501.tar.gz

However, the directory in which my script had intentionally copied the all 4 scripts to be tar-ed and zip-ed only showed 3 files:
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.1.200603130501.768754 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.72.200603140500.768752 1K
a /tmp/osspkg2s/uma/umabass/cs_bsspm_aif/client/out/1003_oxnn2_BSC48379.79.200603140501.768766 1K

For both Listing 1 and Listing 2, could anyone help by pointing out where did I go wrong? Kindly also provide feedbacks and solutions as to how the overall structure of this script can be improved.

Thanks in advance.
Danny
# 2  
Old 03-23-2006
Danny, for your own sake I suggest that you remove the content of your post. There are a number of pieces of information which any RAN operator would not like to have posted on a public website.

I suggest you find & replace the operator name, the RAN manufacturers name and the ids of the specific nodes (BSC and OSS) then repost.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to zip csv files having specific pattern in a directory using UNIX shell script?

I have files in a Linux directory . Some of the file is listed below -rw-rw-r--. 1 roots roots 0 Dec 23 02:17 zzz_123_00000_A_1.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_121_00000_A_2.csv -rw-rw-r--. 1 roots roots 0 Dec 23 02:18 zzz_124_00000_A_3.csv drwxrwxr-x. 2 roots roots 6 Dec 23... (4 Replies)
Discussion started by: Balraj
4 Replies

2. Shell Programming and Scripting

Moving Files one directory to another directory shell script

Hi, Could you please assist how to move the gz files which are older than the 90 days from one folder to another folder ,before that it need to check the file system named "nfs" if size is less than 90 or not. If size is above 90 then it shouldn't perform file move and exit the script throwing... (4 Replies)
Discussion started by: venkat918
4 Replies

3. Shell Programming and Scripting

Script Shell: Diplay date of two minutes (period)

Hi all, Here is my script: #!/bin/sh while :; do sleep 1 date done Please, how can i change this script, i'd like to display the time only of two minutes (period) and exit ? Is that possible ? Thank you so much for help. Bests... (3 Replies)
Discussion started by: chercheur111
3 Replies

4. Shell Programming and Scripting

How to check whether directory has files in it or not in shell script?

hi, I am having script in which i want to check if directory has any file in it or not. If directory contains a single or more files then and only then it should proceed to further operations... P.S.: Directory might have thousand number of files. so there might be chance of getting error... (4 Replies)
Discussion started by: VSom007
4 Replies

5. Shell Programming and Scripting

Shell script to build directory tree and files

Hi all, I'm trying at the moment to write a shell script to build a directory tree and create files within the built directories. I've scoured through sites and text books and I just can't figure out how to go about it. I would assume that I need to use loops of some sort, but I can't seem... (8 Replies)
Discussion started by: Libertad
8 Replies

6. Shell Programming and Scripting

session timeout for shell script

I am executing test.sh script. But this script takes lot of time and in the meantime the shell timeouts without completing the script. Is there any command which will continue processing the script. Thanks (3 Replies)
Discussion started by: infyanurag
3 Replies

7. Shell Programming and Scripting

To run a shell script for a definite period

Hi, I would like to invoke a shell script with period (in seconds) as a parameter and want it to run olny for that period. The script should come out after that period even some work is going inside the script. Regards (2 Replies)
Discussion started by: sanjay1979
2 Replies

8. Shell Programming and Scripting

shell script: deleting files from a directory

i have the following problem: use shell script: Two directories have to be searched for files havin the same name. then delete these files from one of these directories. the directory names have to be accepted as command line arguments. what i have done till now is: 1. run a loop... (1 Reply)
Discussion started by: onlyc
1 Replies

9. Shell Programming and Scripting

Can a timeout be specified in a shell script?

Hi, I have to develop a shell script which exits after <n> minutes. For e.g. The user is taking too much time to enter an input, and the script will terminate after 10 minutes pass by. Is this possible ? Thanks, Puneet (3 Replies)
Discussion started by: puneetarora_12
3 Replies

10. UNIX for Dummies Questions & Answers

Timeout period

How do i increase the timeout period of a telnet session? (4 Replies)
Discussion started by: Nadeem Mistry
4 Replies
Login or Register to Ask a Question