I have a program that regularly forks and execs other programs. Occasionally, the programs that it starts get stuck in their processing and new programs never seem to start processing. We eventually kill a bunch of stuck programs and restart the program that forks/execs them and the issue seems to clear out. The ps output of old/stuck programs (pre kill) and new/working (post restart) programs are different. What can we interpret from the difference between "-ksh -c" and the perl process (pid 6212)? They were invoked in exactly the same way; why is the ps output different? Is there some resource we may be running out of? Virtual terminals?

[me@unixbox1:~]> ps -ef | grep app_bld_rfh2
  appadm 23926     1  0 14:19:34 ?        0:00 -ksh -c /home2/app/eai/app_bld_rfh2.pl  APP.DOC.SERVICE
      me  9232  5237  0 14:38:09 pts/28   0:00 grep app_bld_rfh2
  appadm  2975     1  0 14:30:04 ?        0:00 -ksh -c /home2/app/eai/app_bld_rfh2.pl  APP.DOC.SERVICE
  appadm 17697     1  0 14:14:31 ?        0:00 -ksh -c /home2/app/eai/app_bld_rfh2.pl  APP.DOC.SERVICE
  appadm 11820     1  0 14:09:30 ?        0:00 -ksh -c /home2/app/eai/app_bld_rfh2.pl  APP.DOC.SERVICE
  appadm 29658     1  0 14:25:00 ?        0:00 -ksh -c /home2/app/eai/app_bld_rfh2.pl  APP.DOC.SERVICE
  appadm  6212     1  1 14:35:15 pts/2    0:47 /usr/local/bin/perl /home2/app/eai/app_bld_rfh2.pl APP.DOC.SERVICE
  • How do you launch these scripts, precisely ? – jlliagre May 20 '11 at 5:34

You get the -ksh when it is invoked as the login shell, and my guess is that your perl script /home2/app/eai/app_bld_rfh2.pl starts with the line



#!/usr/bin/env perl

Invoking ksh -c /home2/app/eai/app_bld_rfh2.pl APP.DOC.SERVICE will in turn execute perl based on the above hash-bang. That is the cause of the difference.

As to why it hangs, my guess is that it needs a pseudo-tty to run, so if you start it through ssh use the -t option to force pseudo-tty allocation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.