How to check the killed process's exit code.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Shell > How to check the killed process's exit code.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to check the killed process's exit code.  
empriser


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-07 06:27 AM

kill 12345
How to check the process 12345 exit code ?

I have a client computer and a server computer.  I run a command in
server  from client using rsh command. When I kill the runing process
in server, the client process rsh return exit code 0.  I want to check
the exit code of process in server that have killed by me.






[ Post a follow-up to this message ]



    Re: How to check the killed process's exit code.  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-20-07 12:30 PM

2007-09-20, 02:00(-00), empriser:
> kill 12345
> How to check the process 12345 exit code ?
>
> I have a client computer and a server computer.  I run a command in
> server  from client using rsh command. When I kill the runing process
> in server, the client process rsh return exit code 0.  I want to check
> the exit code of process in server that have killed by me.

Yes, rsh doesn't transfer the exit status of the remote command
to the local machine.

ssh does, so if that's an option you may want to switch.
Otherwise, you may do instead of

rsh somehost '/path/to/my_server'
echo "Exit status was $?"

(which in that case returns 0 unless *rsh* fails)

{
status=$(
rsh somehost '
/path/to/my_server >&2
echo "$?"
'
)
} 2>&1
echo "Exit status was $status"

As rsh opens two channels, one for stdout, one for stderr. The
above makes all the stdout and stderr go to the local stdout so
that the remote stdout can be used to carry the exit status.

This assumes that the user who is executing this has a
Bourne-like shell as its login shell on the remote host.

--
Stéphane





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:57 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register