|
Home > Archive > Unix Shell > February 2007 > Broken pipe re-run
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Broken pipe re-run
|
|
| Gary Wessle 2007-02-26, 7:16 pm |
| Hi
I have a c++ app. which I fire manually or automatically on boot up
using .bashrc like this
****************************************
************************
# Start my own project on boot up "follow-up from .bash_profile"
export PS1='\w\a $ '
cd $HOME/myProg/str1b/
/sbin/fuser ./proj >/dev/null || ./proj
****************************************
************************
sometimes when this app. is running, it stops and gives back the shell
at times when it is not expected to, I found that a Broken pipe fault
which is not handled by the 3rd party library I am using may be the
reason. at such case, I need to restart the application.
the point is, how do I differentiate between a stopped application due
to this fault vs. due to normal stopping, and then come up with a
script that will restart it if it stopped due to the Broken pipe
fault.
I am thankful for any help
| |
| Bo Yang 2007-02-27, 7:21 am |
| Gary Wessle :
> Hi
>
> I have a c++ app. which I fire manually or automatically on boot up
> using .bashrc like this
> ****************************************
************************
> # Start my own project on boot up "follow-up from .bash_profile"
> export PS1='\w\a $ '
> cd $HOME/myProg/str1b/
> /sbin/fuser ./proj >/dev/null || ./proj
> ****************************************
************************
>
> sometimes when this app. is running, it stops and gives back the shell
> at times when it is not expected to, I found that a Broken pipe fault
> which is not handled by the 3rd party library I am using may be the
> reason. at such case, I need to restart the application.
By the application return code, you can achieve what you want. For example:
#!/bin/sh
while true; do
../proj
if [[ $? == the normal exit code ]]; then
exit
fi
done
>
> the point is, how do I differentiate between a stopped application due
> to this fault vs. due to normal stopping, and then come up with a
> script that will restart it if it stopped due to the Broken pipe
> fault.
>
> I am thankful for any help
>
>
>
>
|
|
|
|
|