I've written some code which daemonizes a PHP shell script. It forks the process into the background, kills the parent process, and handles signals for killing the child process.
This all works great, however, STDERR, and STDOUT are still attached to my shell session. What I'd like to do is, within the child process, the equivalent of calling my script with ./myDaemon.php start 2>&1 > /dev/null
without having to to the redirection (in case the parent process needs to output something if the daemonization process fails).
Is this possible?
This will be running on a Linux system, though an interoperable solution would be ideal.