1 /* nohup.c - run commandline with SIGHUP blocked.
3 * Copyright 2011 Rob Landley <rob@landley.net>
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/nohup.html
7 USE_NOHUP(NEWTOY(nohup, "<1^", TOYFLAG_USR|TOYFLAG_BIN))
13 usage: nohup COMMAND [ARGS...]
15 Run a command that survives the end of its terminal.
17 Redirect tty on stdin to /dev/null, tty on stdout to "nohup.out".
24 xsignal(SIGHUP, SIG_IGN);
27 if (-1 == open("nohup.out", O_CREAT|O_APPEND|O_WRONLY,
30 char *temp = getenv("HOME");
32 temp = xmprintf("%s/%s", temp ? temp : "", "nohup.out");
33 xcreate(temp, O_CREAT|O_APPEND|O_WRONLY, 0600);
39 xopen_stdio("/dev/null", O_RDONLY);