Proper signal handling in monitor process