Advanced Programming in the UNIX Environment (3rd Edition) (Addison-Wesley Professional Computing Series) by Stevens W. Richard & Rago Stephen A

Advanced Programming in the UNIX Environment (3rd Edition) (Addison-Wesley Professional Computing Series) by Stevens W. Richard & Rago Stephen A

Author:Stevens, W. Richard & Rago, Stephen A.
Language: eng
Format: epub
Publisher: Pearson Education
Published: 2013-06-09T16:00:00+00:00


void

sigterm(int signo)

{

syslog(LOG_INFO, "got SIGTERM; exiting");

exit(0);

}

void

sighup(int signo)

{

syslog(LOG_INFO, "Re-reading configuration file");

reread();

}

int

main(int argc, char *argv[])

{

char *cmd;

struct sigaction sa;

if ((cmd = strrchr(argv[0], ′/′)) == NULL)

cmd = argv[0];

else

cmd++;

/*

* Become a daemon.

*/

daemonize(cmd);

/*

* Make sure only one copy of the daemon is running.

*/

if (already_running()) {

syslog(LOG_ERR, "daemon already running");

exit(1);

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.