How do I check if a process (Firefox) has quit?

Posted by Al_Jehle on Super User See other posts from Super User or by Al_Jehle
Published on 2012-12-07T19:39:37Z Indexed on 2012/12/07 23:22 UTC
Read the original article Hit count: 128

I am using Ubuntu 12.04 64-bit, with all updates installed.

I made a simple shell script that starts a SOCKS5 tunnel and launches Firefox (with correct network proxy settings) to use the tunnel. How do I recognize when Firefox has ended (when I close it) so that I can close the tunnel? Also, it would be awesome if I could run this in the background, but not necessary.

#!/bin/sh
ssh -fCN -D 10000 server.com
firefox //To lauch firefox using Ubuntu
? Code to determine when firefox has quit
Code that kills the tunnel

© Super User or respective owner

Related posts about firefox

Related posts about ubuntu-12.04