0

i'm running a script from ASP.NET/C# using SharpSsh. I realize when the script runs and i do a ps -ef grep from unix, i see the same script running twice, one in csh -c, and the other with ksh. The script has shebang ksh, so i'm not sure why a copy of csh is also running. Also if i run the same script directly from unix, only one copy runs with ksh. There's no other shell running from within the script.

Templar
  • 63
  • 1
  • 3
  • 1
    Is it possible that SharpSsh is logging in as a user who has csh as their default shell, then it runs your script with the shebang doing the right thing? A ksh script can't be interpreted by csh because the syntax is too different. Also, you could put some debugging output in your script, including using `$$` to output the PID appending it to or touching a file, for example. (I'm not familiar with SharpSsh, by the way.) – Dennis Williamson Jan 13 '11 at 04:27
  • this might be true, as the user's default shell is csh ... but wouldn't it still work anyway? i can run the ksh script from unix using the same user in csh, and it still works. besides, i can't rewrite the script into csh. – Templar Jan 13 '11 at 04:58
  • I'm just saying that may account for it appearing in the process list twice. Perhaps the `csh -c` entry is the process launching the script and the other entry is the script actually running. – Dennis Williamson Jan 14 '11 at 19:17

1 Answers1

1

Most Unix/Linux now have a command or option that will show process trees, with indented list like, look for -t or -T options to ps OR ptree OR ???

  USER     PID    PPID    START TT        TIME CMD
  daemon       1       1 11-03-06 ?            0 init
  myusr   221568       1 11-03-07 tty10    1.00s  \_ -ksh
  myusr   350976  221568 07:52:11 tty10        0  |   \_ ps -efT

I bet you'll see that the csh is the user login shell that includes your script as an argument ( you may have to use different options to ps to see the full command-line of the csh process) AND as a sub process you'll see ksh executing your script, and further sub-processes under ksh for any external commands that the script is calling.

I hope this helps.

P.S. as you appear to be a new user, if you get an answer that helps you please remember to mark it as accepted, or give it a + (or -) as a useful answer.

shellter
  • 36,525
  • 7
  • 83
  • 90