/* Sometimes, httpd becomes inaccessible, try to re-run it */ static void httpd_process_check(void) { int httpd_is_run = pids("httpd"); if (!httpd_is_run) httpd_missing++; else httpd_missing = 0; if (httpd_missing == 1) return; if (!httpd_is_run #ifdef HTTPD_CHECK || !httpd_check_v2() #endif ) { printf("## restart httpd ##\n"); httpd_missing = 0; stop_httpd(); #ifdef HTTPD_CHECK system("killall -9 httpd"); sleep(1); remove(DETECT_HTTPD_FILE); #endif start_httpd(0); } }
/* Sometimes, httpd becomes inaccessible, try to re-run it */ httpd_processcheck(void) { int httpd_is_missing = !pids("httpd"); if (httpd_is_missing) printf("## httpd is gone! ##\n"); #ifndef ASUS_DDNS if (httpd_is_missing #ifdef HTTPD_CHECK || !httpd_check_v2() #endif ) #else // 2007.03.27 Yau add for prevent httpd die when doing hostname check if (httpd_is_missing #ifdef HTTPD_CHECK || (/*!nvram_match("httpd_check_ddns", "1") && */!httpd_check_v2()) #endif ) #endif { printf("## restart httpd ##\n"); stop_httpd(); sleep(1); #ifdef HTTPD_CHECK if (pids("httpdcheck")) system("killall -SIGTERM httpdcheck"); remove(DETECT_HTTPD_FILE); #endif start_httpd(); } }
static void *thread_wrapper(void *arg) { sigset_t ns; /* Block collective signals in the http thread. The http server is * taken down gracefully by signaling the main monit thread */ set_signal_block(&ns, NULL); start_httpd(Run.httpdport, 1024, Run.bind_addr); return NULL; }
void full_restart_ipv6(int ipv6_type_old) { int ipv6_type = get_ipv6_type(); int ipv6_toggled = ((ipv6_type == IPV6_DISABLED || ipv6_type_old == IPV6_DISABLED) && (ipv6_type != ipv6_type_old)) ? 1 : 0; if (ipv6_toggled) { stop_lltd(); stop_httpd(); } stop_upnp(); stop_dhcp6c(); stop_dns_dhcpd(); if (ipv6_type == IPV6_DISABLED) { clear_all_route6(); clear_all_addr6(); clear_if_neigh6(IFNAME_BR); stop_sit_tunnel(); reset_lan6_vars(); reset_wan6_vars(); control_if_ipv6_all(0); set_libc_gai(1); update_resolvconf(0, 1); reload_nat_modules(); restart_firewall(); start_dns_dhcpd(0); } else { set_libc_gai(0); control_if_ipv6_all(1); clear_all_addr6(); reset_lan6_vars(); reload_lan_addr6(); full_restart_wan(); if (!is_dns_dhcpd_run()) start_dns_dhcpd(0); } if (ipv6_toggled) { start_httpd(0); start_lltd(); } }
/* Sometimes, httpd becomes inaccessible, try to re-run it */ static void httpd_processcheck(void) { int httpd_is_missing = !pids("httpd"); if (httpd_is_missing #ifdef HTTPD_CHECK || !httpd_check_v2() #endif ) { printf("## restart httpd ##\n"); stop_httpd(); #ifdef HTTPD_CHECK system("killall -9 httpd"); sleep(1); remove(DETECT_HTTPD_FILE); #endif start_httpd(0); } }
int start_services_once(int is_ap_mode) { start_8021x_wl(); start_8021x_rt(); start_httpd(0); start_telnetd(); #if defined(APP_SSHD) start_sshd(); #endif start_vpn_server(); start_watchdog(); start_infosvr(); if (!is_ap_mode) { if (!is_upnp_run()) start_upnp(); if (!nvram_match("lan_stp", "0")) { doSystem("brctl stp %s %d", IFNAME_BR, 1); doSystem("brctl setfd %s %d", IFNAME_BR, 15); } } else { start_udpxy(IFNAME_BR); #if defined(APP_XUPNPD) start_xupnpd(IFNAME_BR); #endif } start_lltd(); start_watchdog_cpu(); start_networkmap(1); start_rstats(); return 0; }
void restart_httpd(void) { stop_httpd(); start_httpd(1); }
char * mountUrlImage(struct installMethod * method, char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDeps) { int rc; char * url, *p; struct iurlinfo ui; char needsSecondary = ' '; int dir = 1; char * login; char * finalPrefix; char * cdurl; enum { URL_STAGE_MAIN, URL_STAGE_SECOND, URL_STAGE_FETCH, URL_STAGE_DONE } stage = URL_STAGE_MAIN; enum urlprotocol_t proto = !strcmp(method->name, "FTP") ? URL_METHOD_FTP : URL_METHOD_HTTP; /* JKFIXME: we used to do another ram check here... keep it? */ memset(&ui, 0, sizeof(ui)); while (stage != URL_STAGE_DONE) { switch(stage) { case URL_STAGE_MAIN: if ((loaderData->method == METHOD_FTP || loaderData->method == METHOD_HTTP) && loaderData->methodData) { url = ((struct urlInstallData *)loaderData->methodData)->url; logMessage(INFO, "URL_STAGE_MAIN - url is %s", url); if (!url) { logMessage(ERROR, "missing url specification"); loaderData->method = -1; break; } /* explode url into ui struct */ convertURLToUI(url, &ui); /* ks info was adequate, lets skip to fetching image */ stage = URL_STAGE_FETCH; dir = 1; break; } else if (urlMainSetupPanel(&ui, proto, &needsSecondary)) { return NULL; } /* got required information from user, proceed */ stage = (needsSecondary != ' ') ? URL_STAGE_SECOND : URL_STAGE_FETCH; dir = 1; break; case URL_STAGE_SECOND: rc = urlSecondarySetupPanel(&ui, proto); if (rc) { stage = URL_STAGE_MAIN; dir = -1; } else { stage = URL_STAGE_FETCH; dir = 1; } break; case URL_STAGE_FETCH: if (FL_TESTING(flags)) { stage = URL_STAGE_DONE; dir = 1; break; } #ifdef ROCKS /* * before we start the web server, make sure /tmp/rocks.conf * exists */ if (access("/tmp/rocks.conf", F_OK) != 0) { writeAvalancheInfo(NULL, NULL); } start_httpd(); #endif /* ROCKS */ /* ok messy - see if we have a stage2 on local CD */ /* before trying to pull one over network */ cdurl = findAnacondaCD(location, modInfo, modLoaded, *modDeps, 0); if (cdurl) { logMessage(INFO, "Detected stage 2 image on CD"); winStatus(50, 3, _("Media Detected"), _("Local installation media detected..."), 0); sleep(3); newtPopWindow(); stage = URL_STAGE_DONE; dir = 1; } else { /* need to find stage 2 on remote site */ if (loadUrlImages(&ui)) { stage = URL_STAGE_MAIN; dir = -1; if (loaderData->method >= 0) { loaderData->method = -1; } } else { stage = URL_STAGE_DONE; dir = 1; } } break; case URL_STAGE_DONE: break; } } login = ""; login = getLoginName(login, ui); if (!strcmp(ui.prefix, "/")) finalPrefix = "/."; else finalPrefix = ui.prefix; url = malloc(strlen(finalPrefix) + 25 + strlen(ui.address) + strlen(login)); /* sanitize url so we dont have problems like bug #101265 */ /* basically avoid duplicate /'s */ if (ui.protocol == URL_METHOD_HTTP) { for (p=finalPrefix; *p == '/'; p++); finalPrefix = p; } sprintf(url, "%s://%s%s/%s", ui.protocol == URL_METHOD_FTP ? "ftp" : "http", login, ui.address, finalPrefix); return url; }