Running a C# program with mono under Cent OS. There is a fifo that allows external input to go into this program.
I also have cat to accept input from the screen session the mono program is running in.
#! /bin/bash -
echo "Starting server"
mono --gc=sgen Server-CLI.exe < $fifo &
echo $$ > $PIDFILE
cat > $fifo
echo "Server stopped. Cleaning up"
rm -f $fifo
rm -f $PIDFILE
How can I make cat exit whenever the mono program exits? Right now if the mono program exits, cat is still running so the script never reaches the 2nd echo.
Save the PID of
mono. Runcatin the background and save its PID.waitfor the PID ofmono. When this is satisfied,killthe PID ofcat.