Browse Source

[core] cygwin sample to run lighttpd under NSSM

configure NSSM to set environment variables when starting lighttpd
  NSSM_SERVICE_NAME=lighttpd
  NSSM_SERVICE_DIR=/lighttpd/install/dir (optional)
personal/stbuehler/fix-fdevent
Glenn Strauss 3 years ago
parent
commit
0bac13f6b4
  1. 13
      src/server.c

13
src/server.c

@ -1049,6 +1049,19 @@ static int server_main (server * const srv, int argc, char **argv) {
}
}
#ifdef __CYGWIN__
if (!srv->config_storage && NULL != getenv("NSSM_SERVICE_NAME")) {
char *dir = getenv("NSSM_SERVICE_DIR");
if (NULL != dir && 0 != chdir(dir)) {
log_error_write(srv, __FILE__, __LINE__, "sss", "chdir failed:", dir, strerror(errno));
return -1;
}
srv->srvconf.dont_daemonize = 1;
buffer_copy_string_len(srv->srvconf.modules_dir, CONST_STR_LEN("modules"));
if (config_read(srv, "conf/lighttpd.conf")) return -1;
}
#endif
if (!srv->config_storage) {
log_error_write(srv, __FILE__, __LINE__, "s",
"No configuration available. Try using -f option.");

Loading…
Cancel
Save