You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
#include <string.h> /* for memset and stuff */
|
|
#include <syslog.h> /* for logging */
|
|
|
|
#include "include/server.h"
|
|
#include "include/monitor.h"
|
|
#include "include/signalHandling.h"
|
|
#include "include/appConfig.h"
|
|
#include "include/daemonize.h"
|
|
|
|
int verbose;
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
tServer server;
|
|
|
|
tAppConfig appConfig = {
|
|
0,
|
|
0,
|
|
MAXPENDING,
|
|
DEFAULTPORT,
|
|
DEFAULTPATH,
|
|
LOGNAMEPATTERN
|
|
};
|
|
|
|
memset(&server, 0, sizeof(server));
|
|
|
|
handleCmdLine(&appConfig, argc, argv);
|
|
verbose = appConfig.verbose;
|
|
|
|
/* decouple procss from controlling shell and make it session leader */
|
|
if (appConfig.doDaemon) {
|
|
daemonize();
|
|
}
|
|
init_signals();
|
|
openlog(argv[0], LOG_PID, LOG_USER);
|
|
|
|
syslogMonitor(LOG_INFO, MON_INFO, "startup", "service started");
|
|
|
|
serverInit(
|
|
&server,
|
|
appConfig.port,
|
|
appConfig.maxPending,
|
|
appConfig.logPath,
|
|
appConfig.namePat);
|
|
serverRun(&server);
|
|
serverShutdown(&server);
|
|
|
|
return 0;
|
|
}
|