#include #include #include static char **argv_; static void handler(int signal) { printf("got signal %d\n", signal); execv(argv_[0], argv_); } int main(int argc, char *argv[]) { printf("spawned\n"); argv_ = argv; if (signal(SIGTERM, handler) == SIG_ERR) err(1, "could not set signal handler for SIGTERM"); if (signal(SIGHUP, handler) == SIG_ERR) err(1, "could not set signal handler for SIGTERM"); sleep(60); return 0; }