The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
consumption memory tagger AIX 9 10-10-2008 11:34 PM
Ghost Process + CPU consumption neal.opperman SCO 1 02-14-2008 01:53 AM
Memory Consumption Commands siebeladmin HP-UX 2 07-29-2006 10:06 AM
CPU consumption pleaseteachmeun UNIX for Advanced & Expert Users 3 02-17-2006 08:56 AM
Memory consumption of threads Fong AIX 0 08-02-2005 08:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Posts: 12
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
Reply With Quote
Forum Sponsor
  #2  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Location: BlackMesh Managed Hosting
Posts: 66
Kindly repost in English, and with your script provided inside [code] tags.
Reply With Quote
  #3  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Posts: 12
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??
Reply With Quote
  #4  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Location: BlackMesh Managed Hosting
Posts: 66
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
Reply With Quote
  #5  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Posts: 12
Unhappy 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
Reply With Quote
  #6  
Old 07-23-2008
Registered User
 

Join Date: Jul 2008
Location: BlackMesh Managed Hosting
Posts: 66
Quote:
Originally Posted by Prateek007 View Post
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?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:46 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0