[comp.unix.questions] sh -c /usr/ucb/csh -c SCRIPT causes sys ?degradation?

paulg@smokey.SanDiego.NCR.COM (Paul Gladden) (08/17/90)

We are currently developing a application monitoring daemon.
When the daemon detects various application milestones it takes
an appropriate action. One potential action is to execute a user
supplied shell script. I constructed a two line shell script to
log the execution into a log file. Problem is the shell script
executes for minutes. Several shell scripts executing cause
system performance to nose dive.

The daemon executes the shell script via a fork() and system() function
call. We were prepending the user defined shell from $SHELL into
the system() call 

ie. system("-c \"/usr/ucb/csh -c SCRIPT arg1 arg2 arg3 arc4\"");.

I removed the user shell from being passed to the 
system() function. This masks the problem, not solving the
root cause.


The shell script:

echo `date` >> test.log
echo "SMFsh: process action.\n Info = \"$*\"\n" >> test.log


The processes in ?error? are preceded by '>'

   paulg   665   593  0 11:47:22 ttyx013  1:07 stress -c10000                  
    root   661     1  0 11:46:14 ?        1:03 /etc/sysmond                    
   paulg   769   661  0 11:54:44 ?        0:00 /etc/sysmond                    
   paulg   689   661  0 11:47:53 ?        0:00 /etc/sysmond                    
   paulg   690   689  0 11:47:53 ?        0:00 sh -c /usr/ucb/csh -c "./SMFsh /
>  paulg   691   690  1 11:47:53 ?        0:34 /usr/ucb/csh -c ./SMFsh /test/na
   paulg   770   769  0 11:54:48 ?        0:00 sh -c /usr/ucb/csh -c "./SMFsh /
>  paulg   771   770  0 11:54:49 ?        0:55 /usr/ucb/csh -c ./SMFsh /test/na
   paulg   703   661  0 11:48:13 ?        0:00 /etc/sysmond                    
   paulg   704   703  0 11:48:13 ?        0:00 sh -c /usr/ucb/csh -c "./SMFsh /
>  paulg   705   704  0 11:48:13 ?        0:53 /usr/ucb/csh -c ./SMFsh /test/na
   paulg   734   661  0 11:49:28 ?        0:00 /etc/sysmond                    
   paulg   736   734  0 11:49:28 ?        0:00 sh -c /usr/ucb/csh -c "./SMFsh /
>  paulg   737   736  1 11:49:30 ?        2:16 /usr/ucb/csh -c ./SMFsh /test/na


system: MC680020 Unix 5.3

1. What would cause a two line shell to execute for an excessive period of
   time?

2. Has anyone encountered this problem before?


Paul Gladden                     NCR CORPORATION E&M San Diego
paulg@smokey.sandiego.ncr.com    16650 West Bernardo Drive
ucsd!ivory!smokey!paulg          San Diego, Ca. 92128
(619) 485-2716                   #include <std/disclaimer.h>