CPU Consumption comparision.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CPU Consumption comparision.
# 1  
Old 07-23-2008
Question CPU Consumption comparision.

hi,

i hav a script which processes 1000 files one by one in every run jus for searching their corresponding output files at a given path, due to this my script runs for long time and taking more CPU,

can we have any way in which we can have this check at least 100 files in a single shot instead of one by one by a simple loop, and how will it affect the CPU consumption.

Thank You
# 2  
Old 07-23-2008
Kindly repost in English, and with your script provided inside [code] tags.
# 3  
Old 07-23-2008
In the below mentioned script :

[#!/bin/ksh
Home="/tmp/Text"
Path="/abc/def"
find $Path -mtime -1 -print | xargs ls -ld > $Home # Putting latest 24 hours files in $Home

cat $Home | while read line
do
File=$(echo $line|awk '{print $4}');

if [[ -f "$File.SP" ]]
then
echo " File $File is Correct"
else
echo "File $File is Missed"
fi
]

i am checking for the files which are received in last 24 hours( almost 1000 files) in my system and they have their corresponding ".SP" file generated, if not then its a MISS.
Here i am checking 1000 files one by one that their corresponding ".SP" is generated or not. can i have any way common by which i can put this check for more than a file at a time, to minimize the run time of the script?

i mean can we parallely run multiple checks like threading??
# 4  
Old 07-23-2008
Code:
find /abc/def -not -name '*.SP' -exec ./helperscript.sh {} \;

helperscript.sh:
Code:
if [ -e $1.SP ]; then echo "File $1 is Correct"; else echo "File $1 is Missed"; fi

# 5  
Old 07-23-2008
Data thank you so much

sir,

thank you so much for your help,

i am novice to unix, it would be great if you can tell me how i have to write it in my code.

i mean, can i call one script in other if yes how i have to that?

please give me an example

thanks again
# 6  
Old 07-23-2008
Quote:
Originally Posted by Prateek007
sir,

thank you so much for your help,

i am novice to unix, it would be great if you can tell me how i have to write it in my code.

i mean, can i call one script in other if yes how i have to that?

please give me an example

thanks again
At the risk of sounding flippant, why do you have the access or the requirement to do this task if you lack the expertise?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Understanding cpu consumption with TOP

Hi please see attached picture of the TOP command. the "java" process seem to consume 700% of cpu is that mean that he uses 100% of every 7 cpu cores? thanks (2 Replies)
Discussion started by: guy3145
2 Replies

2. UNIX Desktop Questions & Answers

Regarding Memory Consumption

Hi All I am new to UNIX ,can any one please help in finding MEMORY CONSUMPTION of VLC when i use it as Streaming Server. I need to log the memory consumption for atleast 10 hours. Can any one help me in finding this Please (1 Reply)
Discussion started by: ravikanth17
1 Replies

3. Solaris

Problem with Swap consumption

Hi Experts, I have M4000 server with 132 GB Physical memory. 4 sparse zones are running under this server, which are running multiple applications. I am not getting any pointer, where swap space is getting consumed. Almost 97% of swap space is being used. I checked all /tmp (of zones as well),... (7 Replies)
Discussion started by: solaris_1977
7 Replies

4. UNIX for Advanced & Expert Users

Help! CPU consumption - %usr and %sys ??

On Linux, top shows how much % of CPU is consumed by "user" as well as "sys" like below. Tasks: 272 total, 3 running, 268 sleeping, 0 stopped, 1 zombie Cpu(s): 65.9%us, 33.8%sy, 0.0%ni, 0.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 16300960k total, 16212488k used, 88472k free, ... (0 Replies)
Discussion started by: gomes1333
0 Replies

5. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

6. Shell Programming and Scripting

Shell script to display top 5 process (per cpu consumption)

Hello, I have to create shell script being myself real novice in scripting... I was looking on the Internet for some script examples, but I don't have the basic understanding of the shell. I was trying to do something with “ps” command without success. For exemple total number of... (2 Replies)
Discussion started by: mr_awd
2 Replies

7. AIX

consumption memory

Hi, I have a problem with memory on AIX 5.3. On this server, we have JDE Edwards (ERP) and Oracle Database (9.2.0.7.0). We have 4 Gb for physical memory and 3 Gb for paging space. When I stop all services (JDE, Oracle and all other services), the physical memory is not free (4 Gb) svmon... (9 Replies)
Discussion started by: tagger
9 Replies

8. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies

9. SCO

Ghost Process + CPU consumption

Hi everyone, I have a problem on sco unixware 7.1.4 a Ghost process is consuming cpu usage. rtpm cpu 0 ======--------- cpu 1 ===--------------------- cpu 2 ============================================================----------- cpu 3 ... (1 Reply)
Discussion started by: neal.opperman
1 Replies

10. UNIX for Advanced & Expert Users

CPU consumption

Hello experts, I am writing an application in Solaris, which is supposed to work on PrimePower 650 and SunFire 440 machines. The application listens to the events raised by the Hardware and OS in /dev/log. The application listens to the messages logged into /dev/log and do some processing on... (3 Replies)
Discussion started by: pleaseteachmeun
3 Replies
Login or Register to Ask a Question