Operating System - HP-UX
1748279 Members
4238 Online
108761 Solutions
New Discussion

Re: Cron script hogging cpu

 
SOLVED
Go to solution
chindi
Respected Contributor

Cron script hogging cpu

Hi,

We have scron scripts in cron which application users call their profile and execute some scripts.

What we have observed is that for one host when its running its shoots sys% to 75% in top.

What could be the reason ?

 

Script is shown below:

#!/bin/ksh
trap "" 1 2 3 15
set -e
REALNAME=`id | cut -d"(" -f2 | cut -d")" -f1`
exit_value=1
if [ -r /nos/ure/$1 ] ; then
for i in `cat /nos/ure/$1`
do
if [ "$i" = "$REALNAME" ] ; then
exit_value=0
break
fi
done
fi
exit $exit_value

2 REPLIES 2
Steven Schweda
Honored Contributor

Re: Cron script hogging cpu

> What could be the reason ?

   I don't know.  Almost anything?  What's "$1"?  What's in
"/nos/ure/$1"?  What happens when you run the script interactively on
these systems?  (You can test your script on your systems in your
environment more easily than anyone here can.)

> [...] users call their profile [...]

   Do all users have see the same behavior?  What's in "their profile"?
Is the script causing the problem, or is "their profile" causing it?

Dennis Handly
Acclaimed Contributor
Solution

Re: Cron script hogging cpu

What command does top(1) show is using that amount of CPU?

Also, why aren't you using "fgrep -x -q' to find your ID in that file?