08-05-2009
Script with high CPU utilization
Hi All,
i have a script that finds the file with .txt .zip .Z .gzip that are 3 days old in directory /abc/def and removes them
find /abc/def -name '0*.txt' -mtime +6 -exec rm {} \;
find /abc/def -name '0*.zip' -mtime +6 -exec rm {} \;
find /abc/def -name '0*.gzip' -mtime +6 -exec rm {} \;
find /abc/def -name '0*.Z' -mtime +6 -exec rm {} \;
Now the issue is the scripts results in high CPU utilization reaching close to 100%.
How can i optimize my script so that i does not result in high cpu usage.
Please Advice and let me know if any others details are needed.
Note: /abc/def directory contains a lot of files.
10 More Discussions You Might Find Interesting
1. Solaris
Good morning,
I need some help figuring out what's eating up my cpu. My application can't get enough cpu to do its job. this is a sunfire V440 2CPU's at 1/593 GHZ with 8GB of memory. In the morning hours the box is at less than 3%. I can't figure out what else is using the CPU. We use foglight and... (2 Replies)
Discussion started by: bbouhaik
2 Replies
2. AIX
Hi am facing high cpu utilization on my sybase server.
I have P550
Number Of Processors: 4
Processor Clock Speed: 1656 MHz
CPU Type: 64-bit
Kernel Type: 32-bit
LPAR Info: 1 65-D837E
Memory Size: 7840 MB
in topas it shows
Name PID CPU% PgSp Owner
dataserv 565264 ... (1 Reply)
Discussion started by: vjm
1 Replies
3. Shell Programming and Scripting
There is a script which processes the incoming files from a particular directory and sleeps if it doesnt find any. Currently, i have been told that eventhough there are no files to process, the CPU utilization is very high. An independent evaluation by advisory specialist has found this script does... (2 Replies)
Discussion started by: nandu
2 Replies
4. Solaris
Hi,
I am working on a solaris app processor and the vsh goes high from time to time. I have executed various ps commands and switches and have found that it looks like the rlogind daemon is terminating vsh and not cleaning up after itself. There are also something like 10 zombies hanging around... (2 Replies)
Discussion started by: troystevens
2 Replies
5. Shell Programming and Scripting
Hello Team,
I need help in preparing script to check for high cpu utilisation for java process.
I have many java process on my system which consumes high cpu so i have to monitor
it using script.
---------- Post updated 12-10-10 at 02:21 AM ---------- Previous update was 12-09-10 at... (1 Reply)
Discussion started by: coolguyamy
1 Replies
6. UNIX for Advanced & Expert Users
good morning.
just wanted to ask if there's a way to check what causes the high cpu utilization of a server for the past 2 months? My jffnms report resulted to high utilization for a specific server last month. is there a way to check via a command line?
thanks (9 Replies)
Discussion started by: lhareigh890
9 Replies
7. Shell Programming and Scripting
Hello all,
I am very new to unix and trying to solve this problem.
I have cluster of 3 nodes. when I run TOP command on each server, I see a two GZIP processess with very high CPU utilization even,if I don't go backups or unzipping.
Can somebody tell me what is the problem, I don't want... (1 Reply)
Discussion started by: nnani
1 Replies
8. UNIX for Advanced & Expert Users
Hi,
i am observing few processes taking high CPU and when i got some more detials about them it looks like this
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
9452 xmp 25 0 16736 1224 860 R 100.0 0.0 903:54.18 ffmpeg -i -
9777 xmp 25 0 16736 1224 ... (1 Reply)
Discussion started by: Siddheshk
1 Replies
9. Red Hat
Hi Experts,
I need to understand few basic things regarding top command result from one of the node i have collected:
Cpu0 : 4.6%us, 2.0%sy, 0.0%ni, 91.4%id, 1.3%wa, 0.3%hi, 0.3%si, 0.0%st
Cpu1 : 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : ... (5 Replies)
Discussion started by: mackjack87
5 Replies
10. Red Hat
Hi,
Please suggest how to troubleshoot, kswapd is utilizing high cpu?
also wanted to know which parameters are important and needs to be added with sar command for monitoring the performance of Linux (Oracle 5.8 -64 bit
Please guide me.
I am facing the issue where server is getting... (0 Replies)
Discussion started by: manoj.solaris
0 Replies
subst(n) Tcl Built-In Commands subst(n)
__________________________________________________________________________________________________________________________________________________
NAME
subst - Perform backslash, command, and variable substitutions
SYNOPSIS
subst ?-nobackslashes? ?-nocommands? ?-novariables? string
_________________________________________________________________
DESCRIPTION
This command performs variable substitutions, command substitutions, and backslash substitutions on its string argument and returns the
fully-substituted result. The substitutions are performed in exactly the same way as for Tcl commands. As a result, the string argument
is actually substituted twice, once by the Tcl parser in the usual fashion for Tcl commands, and again by the subst command.
If any of the -nobackslashes, -nocommands, or -novariables are specified, then the corresponding substitutions are not performed. For
example, if -nocommands is specified, command substitution is not performed: open and close brackets are treated as ordinary characters
with no special interpretation.
Note that the substitution of one kind can include substitution of other kinds. For example, even when the -novariables option is speci-
fied, command substitution is performed without restriction. This means that any variable substitution necessary to complete the command
substitution will still take place. Likewise, any command substitution necessary to complete a variable substitution will take place, even
when -nocommands is specified. See the EXAMPLES below.
If an error occurs during substitution, then subst will return that error. If a break exception occurs during command or variable substi-
tution, the result of the whole substitution will be the string (as substituted) up to the start of the substitution that raised the excep-
tion. If a continue exception occurs during the evaluation of a command or variable substitution, an empty string will be substituted for
that entire command or variable substitution (as long as it is well-formed Tcl.) If a return exception occurs, or any other return code is
returned during command or variable substitution, then the returned value is substituted for that substitution. See the EXAMPLES below.
In this way, all exceptional return codes are "caught" by subst. The subst command itself will either return an error, or will complete
successfully.
EXAMPLES
When it performs its substitutions, subst does not give any special treatment to double quotes or curly braces (except within command sub-
stitutions) so the script
set a 44
subst {xyz {$a}}
returns "xyz {44}", not "xyz {$a}" and the script
set a "p} q {r"
subst {xyz {$a}}
returns "xyz {p} q {r}", not "xyz {p} q {r}".
When command substitution is performed, it includes any variable substitution necessary to evaluate the script.
set a 44
subst -novariables {$a [format $a]}
returns "$a 44", not "$a $a". Similarly, when variable substitution is performed, it includes any command substitution necessary to
retrieve the value of the variable.
proc b {} {return c}
array set a {c c [b] tricky}
subst -nocommands {[b] $a([b])}
returns "[b] c", not "[b] tricky".
The continue and break exceptions allow command substitutions to prevent substitution of the rest of the command substitution and the rest
of string respectively, giving script authors more options when processing text using subst. For example, the script
subst {abc,[break],def}
returns "abc,", not "abc,,def" and the script
subst {abc,[continue;expr {1+2}],def}
returns "abc,,def", not "abc,3,def".
Other exceptional return codes substitute the returned value
subst {abc,[return foo;expr {1+2}],def}
returns "abc,foo,def", not "abc,3,def" and
subst {abc,[return -code 10 foo;expr {1+2}],def}
also returns "abc,foo,def", not "abc,3,def".
SEE ALSO
Tcl(n), eval(n), break(n), continue(n)
KEYWORDS
backslash substitution, command substitution, variable substitution
Tcl 7.4 subst(n)