Sponsored Content
Top Forums Shell Programming and Scripting Need to process files created an hour ago Post 74901 by negixx on Tuesday 14th of June 2005 09:14:31 AM
Old 06-14-2005
Question Need to process files created an hour ago

Hello all,

I would like to ask for an advice on how to deal with the following scenario.

Every now and then, our ERP system creates an interface text file with the following file format - XORD????.DLD where ???? is a sequence number. We can have 1 or more XORD files created in an hour. Now, I would like to create a script that is run every hour to check XORD* created for the last hour and then verify its contents. How do I approach this using scripting (ksh). The first thing that comes into my mind is to save the result of `ls -lt XORD` to a text file and then sort it but not sure how to compare the time stamp with the current time. Thank you very much

Sample listing of files, say if I run my script now, I wont get anything......

-rw-rw-rw- 1 amcgraw dba 5609 Jun 14 07:17 XORD9306.DLD
-rw-rw-rw- 1 root sys 172859 Jun 14 00:22 XORD9305.DLD
-rw-rw-rw- 1 ldowning dba 7287 Jun 13 17:24 XORD9304.DLD
-rw-rw-rw- 1 root sys 39985 Jun 13 17:05 XORD9303.DLD
-rw-rw-rw- 1 swelch dba 1427 Jun 13 16:20 XORD9302.DLD
-rw-rw-rw- 1 athomas dba 1207 Jun 13 16:09 XORD9301.DLD
-rw-rw-rw- 1 shicks dba 73610 Jun 13 16:07 XORD9300.DLD
-rw-rw-rw- 1 kscott dba 9860 Jun 13 15:52 XORD9299.DLD
-rw-rw-rw- 1 jrobinso dba 2404 Jun 13 15:28 XORD9298.DLD
-rw-rw-rw- 1 dburke dba 2436 Jun 13 14:48 XORD9297.DLD
-rw-rw-rw- 1 srainwat dba 1936 Jun 13 14:26 XORD9296.DLD
-rw-rw-rw- 1 kscott dba 8829 Jun 13 14:18 XORD9295.DLD
-rw-rw-rw- 1 mgwaltne dba 2532 Jun 13 13:57 XORD9294.DLD
-rw-rw-rw- 1 nthackre dba 2754 Jun 13 13:47 XORD9293.DLD
-rw-rw-rw- 1 dburke dba 2186 Jun 13 13:29 XORD9292.DLD
-rw-rw-rw- 1 shicks dba 6543 Jun 13 13:27 XORD9291.DLD
-rw-rw-rw- 1 dburke dba 62840 Jun 13 12:34 XORD9290.DLD
-rw-rw-rw- 1 shicks dba 75595 Jun 13 11:55 XORD9289.DLD

Joseph
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting files created before two days ago

Dear All: I want to build a shell that delete files created two or more days ago ... I think it could be built using a special command with ls or grep, I'd apreciate any help from you guys I have a lot of log files from november, december, january and this tool will help me a lot The files... (3 Replies)
Discussion started by: josecollantes
3 Replies

2. Shell Programming and Scripting

command unix to list all files created since n month ago

Hello, I want to list all files that were created since 3 month ago. it exist a unix command to do it ? thank you (8 Replies)
Discussion started by: yacsil
8 Replies

3. UNIX for Dummies Questions & Answers

file was created before 15 days ago.

How can I get difference date between today and 15 days ago and all filename is was created before 15 days ago? It has to be korn shell script. Thanks. (1 Reply)
Discussion started by: YoungBlood
1 Replies

4. Solaris

Find any spike in CPU usage a hour ago

Folks, I need to find out from the system logs ( or elsewhere ) if the CPU utilization reached say 90% an hour ago from now. Is there a way out. (2 Replies)
Discussion started by: kavera
2 Replies

5. UNIX for Dummies Questions & Answers

To create alist of files created in the last 1 hour.

Hi, I need to create a script whcih ill run ever hour and will check all the files which are created in that hour for an error string. Need help in finding all the files which were created in the last 1 hour. Thanks in Advance. Asheesh (4 Replies)
Discussion started by: Asheesh
4 Replies

6. Shell Programming and Scripting

Check how many minutes ago the last file created

Hi , I need help in getting how many minutes ago the last file, matching some pattern in file name, was created in a folder. Thanks in advance. (8 Replies)
Discussion started by: Anupam_Halder
8 Replies

7. Shell Programming and Scripting

How to find the files created within one hour in Solaris?

Hi Gurus, I want to find the file created within one hour in solaris. I have tried below command, but it is no lucky. $find . -mtime -1/24, -name "abc*" above command give me the file name which created two hours ago find . -cmin -60, -name "abc*" above command I got error as... (4 Replies)
Discussion started by: ken6503
4 Replies
madv.so.1(1)							   User Commands						      madv.so.1(1)

NAME
madv.so.1 - madv library SYNOPSIS
/usr/lib/madv.so.1 DESCRIPTION
The madv.so.1 shared object provides a means by which the VM advice can be selectively configured for a launched process (or processes) and its descendants. To enable madv.so.1, the following string needs to be present in the environment (see ld.so.1(1)) along with one or more MADV environment variables: LD_PRELOAD=$LD_PRELOAD:madv.so.1 ENVIRONMENT VARIABLES
If the madv.so.1 shared object is specified in the LD_PRELOAD list, the following environment variables are read by the madv shared object to determine to which created process(es) to apply the specified advice. MADV=advice MADV specifies the VM advice to use for all heap, shared memory, and mmap regions in the process address space. This advice is applied to all created processes. Values for advice correspond to values in <sys/mman.h> used in madvise(3C) to specify memory access patterns: normal random sequential access_lwp access_many access_default MADVCFGFILE=config-file config-file is a text file which contains one or more madv configuration entries of the form: exec-name exec-args:advice-opts Advice specified in config-file takes precedence over that specified by the MADV environment variable. When MADVCFGFILE is not set, advice is taken from file /etc/madv.conf if it exists. exec-name specifies the name of an application or executable. The corresponding advice is set for newly created processes (see getexec- name(3C)) that match the first exec-name found in the file. exec-name can be a full pathname, a base name, or a pattern string. See File Name Generation in sh(1) for a discussion of pattern matching. exec-args is an optionally specified pattern string to match against arguments. Advice is set only if exec-args is not specified or occurs within the arguments to exec-name. advice-opts is a comma-separated list specifying the advice for various memory region(s): madv=advice Applies to all heap, shared memory, and mmap regions in the process address space. heap=advice The heap is defined to be the brk area (see brk(2)). Applies to the existing heap and for any additional heap mem- ory allocated in the future. shm=advice Shared memory segments (see shmat(2)) attached using any flags, flag SHM_SHARE_MMU, or flag SHM_PAGEABLE respec- ism=advice tively. Options ism and dism take precedence over option shm. dism=advice map=advice Mappings established through mmap(2) using any flags, flag MAP_SHARED, flag MAP_PRIVATE, or flag MAP_ANON, respec- mapshared=advice tively. Options mapshared, mapprivate, and mapanon take precedence over option map. Option mapanon takes precedence mapprivate=advice over mapshared and mapprivate. mapanon=advice MADVERRFILE=pathname By default, error messages are logged via syslog(3C) using level LOG_ERR and facility LOG_USER. If MADVERRFILE contains a valid pathname (such as /dev/stderr), error messages will be logged there instead. EXAMPLES
Example 1: Applying advice to all ISM segments The following configuration applies advice to all ISM segments for application /usr/bin/foo: example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1 example$ MADVCFGFILE=madvcfg example$ export LD_PRELOAD MADVCFGFILE example$ cat $MADVCFGFILE /usr/bin/foo:ism=access_lwp Example 2: Setting advice for all applications with exception The following configuration sets advice for all applications with the exception of ls. example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1 example$ MADV=access_many example$ MADVCFGFILE=madvcfg example$ export LD_PRELOAD MADV MADVCFGFILE example$ cat $MADVCFGFILE ls: Example 3: Precedence rules (continuation from Example 2) Because MADVCFGFILE takes precedence over MADV, specifying '*' (pattern match all) for the exec-name of the last madv configuration entry would be equivalent to setting MADV. The following is equivalent to example 2: example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1 example$ MADVCFGFILE=madvcfg example$ export LD_PRELOAD MADVCFGFILE example$ cat $MADVCFGFILE ls: *:madv=access_many Example 4: Applying advice for different regions The following configuration applies one type of advice for mmap regions and different advice for heap and shared memory regions for a select set of applications with exec names that begin with foo: example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1 example$ MADVCFGFILE=madvcfg example$ export LD_PRELOAD MADVCFGFILE example$ cat $MADVCFGFILE foo*:madv=access_many,heap=sequential,shm=access_lwp Example 5: Applying advice selectively The following configuration applies advice for the heap of applications beginning with ora that have ora1 as an argument: example$ LD_PRELOAD=$LD_PRELOAD:madv.so.1 example$ MADVCFGFILE=madvcfg example$ export LD_PRELOAD MADVCFGFILE example$ cat $MADVCFGFILE ora* ora1:heap=access_many FILES
/etc/madv.conf Configuration file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu (32-bit) | +-----------------------------+-----------------------------+ | |SUNWesxu (64-bit) | +-----------------------------+-----------------------------+ |Interface Stability |Unstable | +-----------------------------+-----------------------------+ SEE ALSO
cat(1), ld.so.1(1), proc(1), sh(1), brk(2), exec(2), fork(2), mmap(2), memcntl(2), shmat(2), getexecname(3C), madvise(3C), syslog(3C), proc(4), attributes(5) NOTES
The advice is inherited. A child process has the same advice as its parent. On exec() (see exec(2)), the advice is set back to the default system advice unless different advice has been configured via the madv shared object. Advice is only applied to mmap regions explicitly created by the user program. Those regions established by the run-time linker or by sys- tem libraries making direct system calls (for example, libthread allocations for thread stacks) are not affected. SunOS 5.10 15 Feb 2002 madv.so.1(1)
All times are GMT -4. The time now is 09:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy