     # if we get a HUP, pass it through to our instance
     process.on "SIGHUP", => process.kill @instance.child.pid, "SIGHUP"
         
-    process.on "SIGTERM", =>
-      # need to shut down instance, but do it gracefully
-      process.kill @instance.child.pid, "SIGINT"
-            
+    process.on "SIGTERM", => @_shutDown()
+          
+    process.on "uncaughtException", => @_shutDown()
+              
     # start our new process, if the app directory exists.  if it doesn't, just 
     # watch and wait
     @_watchForDir path.resolve(@dir,"tmp/restart.txt"), => @_startUp()
 
   #----------
   
+  _shutDown: ->
+    @_notify "Lifeguard got TERM signal. Shutting down."
+    
+    # need to shut down instance, but do it gracefully
+    @instance.forceStop = true
+    process.kill @instance.child.pid, "SIGINT"
+    
+    @instance.on "exit", =>
+        @_notify "Child process has exited."
+        process.exit() 
+  
   # If our entire path doesn't yet exist, walk backward until we find the 
   # longest part that does. watch that directory for the next step in the 
   # tree to appear
   
   _watchForDir: (dir,cb) ->
-    console.log "watchForDir trying #{dir}"
     # loop our way up until we find something that exists    
     lFunc = (d,lcb) =>
       # test this

    # set up a watcher on tmp/restart.txt
    @r_watcher = fs.watch path.resolve(@dir,"tmp/restart.txt"), (type,filename) => 
      # only restart on a touch, not on a deletion (such as when current/ is unlinked)
      @_restartInstance() if fs.existsSync("#{@dir}/tmp/restart.txt")
      
    # watch for our directory to change out from under us
    d_base = path.basename(@dir)

      process.exit()
      
    @dir = path.resolve(@dir)
    
    # create a debounced function for calling restart, so that we don't 
    # trigger multiple times in a row.  This would just be _.debounce, 
    # but bringing underscore in for one thing seemed silly
    
    @debounceRestart = do =>
      _timeout = null
      _ts = 1000
      
      =>
        clearTimeout(_timeout)
        _timeout = setTimeout =>
          _timeout = null
          @_restartInstance()
        , _ts
    
    # -- Startup -- #
        
