Project

General

Profile

unbound-stop.diff

Jim Pingle, 07/07/2017 01:42 PM

View differences:

src/etc/inc/services.inc
2235 2235
		echo "services_unbound_configure() being called $mt\n";
2236 2236
	}
2237 2237

  
2238
	// kill any running Unbound instance
2239
	if (file_exists("{$g['varrun_path']}/unbound.pid")) {
2240
		sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
2241
	}
2242

  
2243 2238
	if (isset($config['unbound']['enable'])) {
2239
		require_once('/etc/inc/unbound.inc');
2240

  
2241
		/* Stop Unbound using TERM */
2242
		if (file_exists("{$g['varrun_path']}/unbound.pid")) {
2243
			sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM");
2244
		}
2245

  
2246
		/* If unbound is still running, wait up to 30 seconds for it to terminate. */
2247
		for ($i=1; $i <= 30; $i++) {
2248
			if (is_process_running('unbound')) {
2249
				sleep(1);
2250
			}
2251
		}
2252

  
2244 2253
		if (platform_booting()) {
2245 2254
			echo gettext("Starting DNS Resolver...");
2246 2255
		} else {
......
2252 2261
			$return = 1;
2253 2262
		}
2254 2263

  
2255
		require_once('/etc/inc/unbound.inc');
2256 2264
		sync_unbound_service();
2257 2265
		if (platform_booting()) {
2258 2266
			echo gettext("done.") . "\n";
2259 2267
		}
2260 2268

  
2261 2269
		system_dhcpleases_configure();
2270
	} else {
2271
		/* kill Unbound since it should not be enabled */
2272
		if (file_exists("{$g['varrun_path']}/unbound.pid")) {
2273
			sigkillbypid("{$g['varrun_path']}/unbound.pid", "KILL");
2274
		}
2262 2275
	}
2263 2276

  
2264 2277
	if (!platform_booting() && $restart_dhcp) {