Sponsored Content
Top Forums Shell Programming and Scripting Writing to a log file incorrectly Post 302096786 by heprox on Saturday 18th of November 2006 02:39:21 PM
Old 11-18-2006
Question

I replaced the "for in" loop but it didn't process the files correctly, the section now looks like:

Code:
nsec=1
while [[ "$(date +%H%M)" -lt 2340 ]]
do
   ls $DatafilesDir/[Uu][Pp][Ll][Oo][Aa][Dd].[0-9][0-9][0-9][0-9] 2>/dev/null \
   while read filename
   do
      fileExtension=${fileName#*.}
      is_file_arrived "$fileName"
      if [ $arrived = 0 ]; then
         if [ ! -f "$TempDir/poll_$fileExtension.txt" ]; then
            nsec=1
            processFile $fileName $fileExtension
         else
            log_it "Store $fileExtension is already in process"
         fi
      fi
   done
   sleep $nsec
   case $nsec in
      1)   nsec=15;;
      15)  nsec=45;;
      45)  nsec=90;;
      90)  nsec=300;;
      300) nsec=600;;
      *) nsec=900;;
   esac
done

It didn't create a log file at all, but the process did:

Code:
+ ls /gers/genret/datafiles/UPLOAD.0007 /gers/genret/datafiles/UPLOAD.0012 /gers
/genret/datafiles/UPLOAD.0016 /gers/genret/datafiles/UPLOAD.0017 /gers/genret/da
tafiles/UPLOAD.0039
+ 2> /dev/null
+ fileExtension=
+ is_file_arrived
+ [ 1 = 0 ]
+ read filename
+ fileExtension=
+ is_file_arrived
+ [ 1 = 0 ]
+ read filename
+ fileExtension=
+ is_file_arrived
+ [ 1 = 0 ]
+ read filename
+ fileExtension=
+ is_file_arrived
+ [ 1 = 0 ]
+ read filename
+ fileExtension=
+ is_file_arrived
+ [ 1 = 0 ]
+ read filename
+ sleep 1

I'm thoroughly confused now...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Which Process is writing this Log file!!

Hello , Well I have some /tmp files which are growing very quickly..Can anyone suggest me a way to find which process is logging into this file :confused: ? Thanks very much in Advance!! Mohammed (2 Replies)
Discussion started by: Mohammed
2 Replies

2. UNIX for Advanced & Expert Users

writing the log file into syslog

Hi, we are trying to enable auditing for few oracle 9i database. and right now it writies into adump directory. As adump can be read/write by oracle user so could it be possible to write into syslog while oracle keeps writing to adump . thanks in advance. Pk (2 Replies)
Discussion started by: p4cldba
2 Replies

3. UNIX for Dummies Questions & Answers

Log File Writing and Reading

Hi all, I have the following shell script code which tries to sftp and writes the log into the log file. TestConnection () { echo 'Connection to ' $DESTUSERNAME@$DESTHOSTNAME $SETDEBUG if ]; then rm $SCRIPT ; fi touch $SCRIPT echo "cd" $REMOTEDIR >> $SCRIPT echo "quit" >>... (10 Replies)
Discussion started by: valluvan
10 Replies

4. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

5. Shell Programming and Scripting

Format the output from sqlplus while writing to log file.

Hi I have developed bash script to connect to database and execute .sql files. I am logging some statements in to log file using echo. While logging I am adding the date in front of the log statements which makes sense. I am unable to add date in front of output from the sqlplus and sqlldr,... (8 Replies)
Discussion started by: murtymvvs
8 Replies

6. Shell Programming and Scripting

Totals in a file - incorrectly displaying

Afternoon, I have a script which creates/modifies data into a formatted csv. The trailer record should display 2 columns, the first is a static entry of "T" to identify it as a trailer record. The 2nd is a total of amounts in a column throughout the entire file. My total isn't displaying... (8 Replies)
Discussion started by: mcclunyboy
8 Replies

7. Shell Programming and Scripting

Need help in writing a script that do internal grep on a log file..and extract acct no's from it..

I need to write a script, which takes the input a log file and create output file with acct no's line by line from selected records with text like (in red) : 18:51:18 | 217863|Acct 0110855565|RC 17608| 16 Subs| 1596 UsgRecs| 2 Secs| 430 CPUms| prmis2:26213 <MoveUsage d aemon needs to run... (7 Replies)
Discussion started by: rkrish
7 Replies

8. UNIX for Dummies Questions & Answers

Syslog Messages from Remote Server are not writing to Log File Anymore

Hello All, Server: SUSE Linux Enterprise Server 11.3 (x86_64) Syslog-ng Version: syslog-ng 2.0.9 We have configured a Cisco router to send it's log messages to this server listed above. This has been working just perfectly for the last couple months, but we had never setup the log... (9 Replies)
Discussion started by: mrm5102
9 Replies

9. UNIX for Beginners Questions & Answers

Ls incorrectly says file not found in sftp.

Hi all When I sftp to an Oracle cloud server, to a folder where there are more than 10k files, and list a small subset of files, it works OK. When I try list more than 10k files, it says file not found. Example output below. (FYI ls/mget with 6k files works OK on this server) Has anyone... (3 Replies)
Discussion started by: pdinsdale
3 Replies

10. Shell Programming and Scripting

Large File masking incorrectly happening Ç delimeter issue

The OS version is Red Hat Enterprise Linux Server release 6.10 I have a script to mask some columns with **** in a data file which is delimeted with Ç , I am using awk for the masking , when I try to mask a small file the awk works fine and masks the required column , but when the file is... (6 Replies)
Discussion started by: LinuxUser8092
6 Replies
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_dnssec_name_new, ldns_dnssec_name_new_frm_rr, ldns_dnssec_name_free, ldns_dnssec_name_name, ldns_dnssec_name_set_name, ldns_dnssec_name_set_nsec, ldns_dnssec_name_cmp, ldns_dnssec_name_add_rr, ldns_dnssec_name_find_rrset, ldns_dnssec_name_print- SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> ldns_dnssec_name* ldns_dnssec_name_new(); ldns_dnssec_name* ldns_dnssec_name_new_frm_rr(ldns_rr *rr); void ldns_dnssec_name_free(ldns_dnssec_name *name); ldns_rdf* ldns_dnssec_name_name(ldns_dnssec_name *name); void ldns_dnssec_name_set_name(ldns_dnssec_name *name, ldns_rdf *dname); void ldns_dnssec_name_set_nsec(ldns_dnssec_name *name, ldns_rr *nsec); int ldns_dnssec_name_cmp(const void *a, const void *b); ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, ldns_rr *rr); ldns_dnssec_rrsets* ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, ldns_rr_type type); void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name); DESCRIPTION
ldns_dnssec_name_new() Create a new data structure for a dnssec name Returns the allocated structure ldns_dnssec_name_new_frm_rr() Create a new data structure for a dnssec name for the given RR rr: the RR to derive properties from, and to add to the name ldns_dnssec_name_free() Frees the name structure and its rrs and rrsets. Individual ldns_rr records therein are not freed name: the structure to free ldns_dnssec_name_name() Returns the domain name of the given dnssec_name structure name: the dnssec name to get the domain name from Returns the domain name ldns_dnssec_name_set_name() Sets the domain name of the given dnssec_name structure name: the dnssec name to set the domain name of dname: the domain name to set it to. This data is *not* copied. ldns_dnssec_name_set_nsec() Sets the NSEC(3) RR of the given dnssec_name structure name: the dnssec name to set the domain name of nsec: the nsec rr to set it to. This data is *not* copied. ldns_dnssec_name_cmp() Compares the domain names of the two arguments in their canonical ordening. a: The first dnssec_name to compare b: The second dnssec_name to compare Returns -1 if the domain name of a comes before that of b in canonical ordening, 1 if it is the other way around, and 0 if they are equal ldns_dnssec_name_add_rr() Inserts the given rr at the right place in the current dnssec_name No checking is done whether the name matches name: The ldns_dnssec_name to add the RR to rr: The RR to add Returns LDNS_STATUS_OK on success, error code otherwise ldns_dnssec_name_find_rrset() Find the RRset with the given type in within this name structure name: the name to find the RRset in type: the type of the RRset to find Returns the RRset, or NULL if not present ldns_dnssec_name_print() Prints the RRs in the dnssec name structure to the given file descriptor out: the file descriptor to print to name: the name structure to print the contents of AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_dnssec_zone. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 11:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy