Project

General

Profile

Download (18.6 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/****h* pfSense/service-utils
3
 * NAME
4
 *   service-utils.inc - Service facility
5
 * DESCRIPTION
6
 *   This file contains various functions used by the pfSense service facility.
7
 * HISTORY
8
 *   $Id$
9
 ******
10
 *
11
 * Copyright (C) 2005-2006 Colin Smith (ethethlay@gmail.com)
12
 * All rights reserved.
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are met:
15
 *
16
 * 1. Redistributions of source code must retain the above copyright notice,
17
 * this list of conditions and the following disclaimer.
18
 *
19
 * 2. Redistributions in binary form must reproduce the above copyright
20
 * notice, this list of conditions and the following disclaimer in the
21
 * documentation and/or other materials provided with the distribution.
22
 *
23
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26
 * AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
27
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31
 * RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32
 * POSSIBILITY OF SUCH DAMAGE.
33
 *
34
 */
35

    
36
/*
37
	pfSense_BUILDER_BINARIES:	/bin/pgrep /bin/sh /usr/bin/killall
38
	pfSense_MODULE:	utils
39
*/
40
require_once("globals.inc");
41
require_once("captiveportal.inc");
42
require_once("openvpn.inc");
43
require_once("ipsec.inc");
44
require_once("vpn.inc");
45
require_once("vslb.inc");
46

    
47
define("RCFILEPREFIX", "/usr/local/etc/rc.d/");
48
function write_rcfile($params) {
49
	global $g;
50

    
51
	$rcfile_fullname = RCFILEPREFIX . $params['file'];
52
	if (!file_exists($rcfile_fullname) && !touch($rcfile_fullname))
53
		return false;
54

    
55
	if (!is_writable($rcfile_fullname) || empty($params['start']))
56
		return false;
57

    
58
	$towrite = "#!/bin/sh\n";
59
	$towrite .= "# This file was automatically generated\n# by the {$g['product_name']} service handler.\n\n";
60

    
61
	/* write our rc functions */
62
	$towrite .= "rc_start() {\n";
63
	$towrite .= "\t{$params['start']}\n";
64
	$towrite .= "}\n\n";
65
	if(!empty($params['stop'])) {
66
		$tokill =& $params['stop'];
67
	} else if(!empty($params['executable'])) {
68
		/* just nuke the executable */
69
		$tokill = "/usr/bin/killall {$params['executable']}";
70
	} else {
71
		/* make an educated guess (bad) */
72
		$tokill = array_pop(explode('/', array_shift(explode(' ', $params['start']))));
73
	}
74
	$towrite .= "rc_stop() {\n";
75
	$towrite .= "\t{$tokill}\n";
76
	$towrite .= "}\n\n";
77

    
78
	/* begin rcfile logic */
79
	$towrite .= "case \$1 in\n\tstart)\n\t\trc_start\n\t\t;;\n\tstop)\n\t\trc_stop\n\t\t;;\n\trestart)\n\t\trc_stop\n\t\trc_start\n\t\t;;\nesac\n\n";
80

    
81
	file_put_contents($rcfile_fullname, $towrite);
82
	@chmod("{$rcfile_fullname}", 0755);
83

    
84
	return;
85
}
86

    
87
function start_service($name) {
88
	global $config;
89

    
90
	if (empty($name))
91
		return;
92

    
93
	/* make sure service is stopped before starting */
94
	stop_service($name);
95
	sleep(2);
96

    
97
	$rcfile_fullname = RCFILEPREFIX . $name . '.sh';
98
	if(file_exists($rcfile_fullname)) {
99
		mwexec_bg("/bin/sh {$rcfile_fullname} start");
100
		return;
101
	}
102
	if($config['installedpackages']['service']) {
103
		foreach($config['installedpackages']['service'] as $service) {
104
			if(strtolower($service['name']) == strtolower($name)) {
105
				if($service['rcfile']) {
106
					$prefix = RCFILEPREFIX;
107
					if (!empty($service['prefix'])) {
108
						$prefix =& $service['prefix'];
109
					}
110
					if(file_exists("{$prefix}{$service['rcfile']}")) {
111
						mwexec_bg("{$prefix}{$service['rcfile']} start");
112
					}
113
				}
114
				if (!empty($service['startcmd']))
115
					eval($service['startcmd']);
116
				break;
117
			}
118
		}
119
	}
120
}
121

    
122
function stop_service($name) {
123
	global $config;
124

    
125
	if (empty($name))
126
		return;
127

    
128
	if ($config['installedpackages']['service']) {
129
		foreach($config['installedpackages']['service'] as $service) {
130
			if(strtolower($service['name']) == strtolower($name)) {
131
				if($service['rcfile']) {
132
					$prefix = RCFILEPREFIX;
133
					if(!empty($service['prefix'])) {
134
						$prefix =& $service['prefix'];
135
					}
136
					if(file_exists("{$prefix}{$service['rcfile']}")) {
137
						mwexec("{$prefix}{$service['rcfile']} stop");
138
					}
139
					return;
140
				}
141
				if (!empty($service['stopcmd']))
142
					eval($service['stopcmd']);
143

    
144
				if(!($service['rcfile'] or $service['stopcmd'])) {
145
					if(is_process_running("{$service['executable']}"))
146
						mwexec("/usr/bin/killall {$service['executable']}");
147
					return;
148
				}
149
				break;
150
			}
151
		}
152
	}
153
	/* finally if we get here lets simply kill the service name */
154
	if(is_process_running("{$name}"))
155
		mwexec("/usr/bin/killall {$name}");
156
}
157

    
158
function restart_service($name) {
159
	global $config;
160

    
161
	if (empty($name))
162
		return;
163

    
164
	stop_service($name);
165
	start_service($name);
166

    
167
	if($config['installedpackages']['service']) {
168
		foreach($config['installedpackages']['service'] as $service) {
169
			if(strtolower($service['name']) == strtolower($name)) {
170
				if($service['restartcmd']) {
171
					eval($service['restartcmd']);
172
				}
173
				break;
174
			}
175
		}
176
	}
177
}
178

    
179
function is_pid_running($pidfile) {
180
	if (!file_exists($pidfile))
181
		return false;
182

    
183
	return (isvalidpid($pidfile));
184
}
185

    
186
function is_dhcp_running($interface) {
187
	$status = find_dhclient_process($interface);
188
	if($status <> "")
189
		return true;
190
	return false;
191
}
192

    
193
function restart_service_if_running($service) {
194
	global $config;
195
	if(is_service_running($service))
196
		restart_service($service);
197
	return;
198
}
199

    
200
function is_service_running($service, $ps = "") {
201
	global $config;
202

    
203
	if(is_array($config['installedpackages']['service'])) {
204
		foreach($config['installedpackages']['service'] as $aservice) {
205
			if(strtolower($service) == strtolower($aservice['name'])) {
206
				if ($aservice['custom_php_service_status_command'] <> "") {
207
					eval("\$rc={$aservice['custom_php_service_status_command']};");
208
					return $rc;
209
				}
210
				if(empty($aservice['executable']))
211
					return false;
212
				if (is_process_running($aservice['executable']))
213
					return true;
214

    
215
				return false;
216
			}
217
		}
218
	}
219

    
220
	if (is_process_running($service))
221
		return true;
222

    
223
	return false;
224
}
225

    
226
function get_services() {
227
	global $config;
228
	if (is_array($config['installedpackages']['service']))
229
		$services = $config['installedpackages']['service'];
230
	else
231
		$services = array();
232

    
233
	/*    Add services that are in the base.
234
	 *
235
	 */
236
	if(is_radvd_enabled()) {
237
		$pconfig = array();
238
		$pconfig['name'] = "radvd";
239
		$pconfig['description'] = gettext("Router Advertisement Daemon");
240
		$services[] = $pconfig;
241
	}
242

    
243
	if(isset($config['dnsmasq']['enable'])) {
244
		$pconfig = array();
245
		$pconfig['name'] = "dnsmasq";
246
		$pconfig['description'] = gettext("DNS Forwarder");
247
		$services[] = $pconfig;
248
	}
249

    
250
	$pconfig = array();
251
	$pconfig['name'] = "ntpd";
252
	$pconfig['description'] = gettext("NTP clock sync");
253
	$services[] = $pconfig;
254

    
255
	if (is_array($config['captiveportal'])) {
256
		foreach ($config['captiveportal'] as $zone => $setting) {
257
			if (isset($setting['enable'])) {
258
				$pconfig = array();
259
				$pconfig['name'] = "captiveportal";
260
				$pconfig['zone'] = $zone;
261
				$pconfig['description'] = gettext("Captive Portal") . ": ".htmlspecialchars($setting['zone']);
262
				$services[] = $pconfig;
263
			}
264
		}
265
	}
266

    
267
	$iflist = array();
268
	$ifdescrs = get_configured_interface_list();
269
	foreach ($ifdescrs as $if) {
270
		$oc = $config['interfaces'][$if];
271
		if ($oc['if'] && (!link_interface_to_bridge($if)))
272
			$iflist[$if] = $if;
273
	}
274
	$show_dhcprelay = false;
275
	foreach($iflist as $if) {
276
		if(isset($config['dhcrelay'][$if]['enable']))
277
			$show_dhcprelay = true;
278
	}
279

    
280
	if($show_dhcprelay == true) {
281
		$pconfig = array();
282
		$pconfig['name'] = "dhcrelay";
283
		$pconfig['description'] = gettext("DHCP Relay");
284
		$services[] = $pconfig;
285
	}
286

    
287
	if(is_dhcp_server_enabled()) {
288
		$pconfig = array();
289
		$pconfig['name'] = "dhcpd";
290
		$pconfig['description'] = gettext("DHCP Service");
291
		$services[] = $pconfig;
292
	}
293

    
294
	if(isset($config['snmpd']['enable'])) {
295
		$pconfig = array();
296
		$pconfig['name'] = "bsnmpd";
297
		$pconfig['description'] = gettext("SNMP Service");
298
		$services[] = $pconfig;
299
	}
300

    
301
	if (is_array($config['igmpproxy']['igmpentry']) && (count($config['igmpproxy']['igmpentry']) > 0)) {
302
		$pconfig = array();
303
		$pconfig['name'] = "igmpproxy";
304
		$pconfig['description'] = gettext("IGMP proxy");
305
		$services[] = $pconfig;
306
	}
307

    
308
	if (isset($config['installedpackages']['miniupnpd']) && $config['installedpackages']['miniupnpd']['config'][0]['enable']) {
309
		$pconfig = array();
310
		$pconfig['name'] = "miniupnpd";
311
		$pconfig['description'] = gettext("UPnP Service");
312
		$services[] = $pconfig;
313
	}
314

    
315
	if (isset($config['installedpackages']['routed']) && $config['installedpackages']['routed']['config'][0]['enable']) {
316
		$pconfig = array();
317
		$pconfig['name'] = "routed";
318
		$pconfig['description'] = gettext("RIP Daemon");
319
		$services[] = $pconfig;
320
	}
321

    
322
	if (isset($config['ipsec']['enable'])) {
323
		$pconfig = array();
324
		$pconfig['name'] = "racoon";
325
		$pconfig['description'] = gettext("IPsec VPN");
326
		$services[] = $pconfig;
327
	}
328

    
329
	foreach (array('server', 'client') as $mode) {
330
		if (is_array($config['openvpn']["openvpn-{$mode}"])) {
331
			foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
332
				if (!isset($setting['disable'])) {
333
					$pconfig = array();
334
					$pconfig['name'] = "openvpn";
335
					$pconfig['mode'] = $mode;
336
					$pconfig['id'] = $id;
337
					$pconfig['vpnid'] = $setting['vpnid'];
338
					$pconfig['description'] = gettext("OpenVPN") . " ".$mode.": ".htmlspecialchars($setting['description']);
339
					$services[] = $pconfig;
340
				}
341
			}
342
		}
343
	}
344

    
345
	if (count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) {
346
		$pconfig = array();
347
		$pconfig['name'] = "relayd";
348
		$pconfig['description'] = gettext("Server load balancing daemon");
349
		$services[] = $pconfig;
350
	}
351
	return $services;
352
}
353

    
354
function find_service_by_name($name) {
355
	$services = get_services();
356
	foreach ($services as $service)
357
		if ($service["name"] == $name)
358
			return $service;
359
	return array();
360
}
361

    
362
function find_service_by_openvpn_vpnid($vpnid) {
363
	$services = get_services();
364
	foreach ($services as $service)
365
		if (($service["name"] == "openvpn") && isset($service["vpnid"]) && ($service["vpnid"] == $vpnid))
366
			return $service;
367
	return array();
368
}
369

    
370
function find_service_by_cp_zone($zone) {
371
	$services = get_services();
372
	foreach ($services as $service)
373
		if (($service["name"] == "captiveportal") && isset($service["zone"]) && ($service["zone"] == $zone))
374
			return $service;
375
	return array();
376
}
377

    
378
function service_name_compare($a, $b) {
379
	if (strtolower($a['name']) == strtolower($b['name']))
380
		return 0;
381
	return (strtolower($a['name']) < strtolower($b['name'])) ? -1 : 1;
382
}
383

    
384
function get_pkg_descr($package_name) {
385
	global $config;
386
	if (is_array($config['installedpackages']['package'])) {
387
		foreach($config['installedpackages']['package'] as $pkg) {
388
			if($pkg['name'] == $package_name)
389
				return $pkg['descr'];
390
		}
391
	}
392
	return gettext("Not available.");
393
}
394

    
395
function get_service_status($service) {
396
	global $g;
397
	switch ($service['name']) {
398
		case "openvpn":
399
			$running = is_pid_running("{$g['varrun_path']}/openvpn_{$service['mode']}{$service['vpnid']}.pid");
400
			break;
401
		case "captiveportal":
402
			$running = is_pid_running("{$g['varrun_path']}/lighty-{$service['zone']}-CaptivePortal.pid");
403
			if (isset($config['captiveportal'][$service['zone']]['httpslogin']))
404
				$running = $running && is_pid_running("{$g['varrun_path']}/lighty-{$service['zone']}-CaptivePortal-SSL.pid");
405
			break;
406
		default:
407
			$running = is_service_running($service['name']);
408
	}
409
	return $running;
410
}
411

    
412
function get_service_status_icon($service, $withtext = true, $smallicon = false) {
413
	global $g;
414
	$output = "";
415
	if(get_service_status($service)) {
416
		$statustext = gettext("Running");
417
		$output .= '<td class="listr" align="center">' . "\n";
418
		$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/";
419
		$output .= ($smallicon) ? "icon_pass.gif" : "icon_service_running.gif";
420
		$output .= "\" alt=\"status\" />";
421
		if ($withtext)
422
			$output .= "&nbsp;&nbsp;" . $statustext;
423
		$output .= "</td>\n";
424
	} else {
425
		$statustext = gettext("Stopped");
426
		$output .= '<td class="listbg" align="center">' . "\n";
427
		$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/";
428
		$output .= ($smallicon) ? "icon_block.gif" : "icon_service_stopped.gif";
429
		$output .= "\" alt=\"status\" />";
430
		if ($withtext)
431
			$output .= "&nbsp;&nbsp;" . "<font color=\"white\">{$statustext}</font>";
432
		$output .= "</td>\n";
433
	}
434
	return $output;
435
}
436

    
437
function get_service_control_links($service, $addname = false) {
438
	global $g;
439
	$output = "";
440
	$stitle = ($addname) ? $service['name'] . " " : "";
441
	if(get_service_status($service)) {
442
		switch ($service['name']) {
443
			case "openvpn":
444
				$output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
445
				break;
446
			case "captiveportal":
447
				$output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
448
				break;
449
			default:
450
				$output .= "<a href='status_services.php?mode=restartservice&amp;service={$service['name']}'>";
451
		}
452
		$output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Restart %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_restart.gif' alt='restart' /></a>\n";
453
		switch ($service['name']) {
454
			case "openvpn":
455
				$output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
456
				break;
457
			case "captiveportal":
458
				$output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
459
				break;
460
			default:
461
				$output .= "<a href='status_services.php?mode=stopservice&amp;service={$service['name']}'>";
462
		}
463
		$output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Stop %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_stop.gif' alt='stop' />";
464
		$output .= "</a>";
465
	} else {
466
		switch ($service['name']) {
467
			case "openvpn":
468
				$output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}&amp;vpnmode={$service['mode']}&amp;id={$service['vpnid']}'>";
469
				break;
470
			case "captiveportal":
471
				$output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}&amp;zone={$service['zone']}'>";
472
				break;
473
			default:
474
				$output .= "<a href='status_services.php?mode=startservice&amp;service={$service['name']}'>";
475
		}
476
		$output .= "<img style=\"vertical-align:middle\" title='" . sprintf(gettext("Start %sService"),$stitle) . "' border='0' src='./themes/".$g['theme']."/images/icons/icon_service_start.gif' alt='start' /></a>\n";
477
	}
478
	return $output;
479
}
480

    
481
function service_control_start($name, $extras) {
482
	global $g;
483
	switch($name) {
484
		case 'radvd':
485
			services_radvd_configure();
486
			break;
487
		case 'captiveportal':
488
			$zone = $extras['zone'];
489
			captiveportal_init_webgui_zonename($zone);
490
			break;
491
		case 'ntpd':
492
		case 'openntpd':
493
			system_ntp_configure();
494
			break;
495
		case 'bsnmpd':
496
			services_snmpd_configure();
497
			break;
498
		case 'dnsmasq':
499
			services_dnsmasq_configure();
500
			break;
501
		case 'dhcpd':
502
			services_dhcpd_configure();
503
			break;
504
		case 'igmpproxy':
505
			services_igmpproxy_configure();
506
			break;
507
		case 'miniupnpd':
508
			upnp_action('start');
509
			break;
510
		case 'racoon':
511
			vpn_ipsec_force_reload();
512
			break;
513
		case 'openvpn':
514
			$vpnmode = $extras['vpnmode'];
515
			if (($vpnmode == "server") || ($vpnmode == "client")) {
516
				$id = $extras['id'];
517
				$configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf";
518
				if (file_exists($configfile))
519
					openvpn_restart_by_vpnid($vpnmode, $id);
520
			}
521
			break;
522
		case 'relayd':
523
			relayd_configure();
524
			break;
525
		default:
526
			start_service($name);
527
			break;
528
	}
529
	return sprintf(gettext("%s has been started."),htmlspecialchars($name));
530
}
531
function service_control_stop($name, $extras) {
532
	global $g;
533
	switch($name) {
534
		case 'radvd':
535
			killbypid("{$g['varrun_path']}/radvd.pid");
536
			break;
537
		case 'captiveportal':
538
			$zone = $extras['zone'];
539
			killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal.pid");
540
			killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal-SSL.pid");
541
			break;
542
		case 'ntpd':
543
			killbyname("ntpd");
544
			break;
545
		case 'openntpd':
546
			killbyname("openntpd");
547
			break;
548
		case 'bsnmpd':
549
			killbypid("{$g['varrun_path']}/snmpd.pid");
550
			break;
551
		case 'choparp':
552
			killbyname("choparp");
553
			break;
554
		case 'dhcpd':
555
			killbyname("dhcpd");
556
			break;
557
		case 'dhcrelay':
558
			killbypid("{$g['varrun_path']}/dhcrelay.pid");
559
			break;
560
		case 'dnsmasq':
561
			killbypid("{$g['varrun_path']}/dnsmasq.pid");
562
			break;
563
		case 'igmpproxy':
564
			killbyname("igmpproxy");
565
			break;
566
		case 'miniupnpd':
567
			upnp_action('stop');
568
			break;
569
		case 'sshd':
570
			killbyname("sshd");
571
			break;
572
		case 'racoon':
573
			exec("killall -9 racoon");
574
			break;
575
		case 'openvpn':
576
			$vpnmode = $extras['vpnmode'];
577
			if (($vpnmode == "server") or ($vpnmode == "client")) {
578
				$id = $extras['id'];
579
				$pidfile = "{$g['varrun_path']}/openvpn_{$vpnmode}{$id}.pid";
580
				killbypid($pidfile);
581
			}
582
			break;
583
		case 'relayd':
584
			mwexec('pkill relayd');
585
			break;
586
		default:
587
			stop_service($name);
588
			break;
589
	}
590
	return sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
591
}
592
function service_control_restart($name, $extras) {
593
	global $g;
594
	switch($name) {
595
		case 'radvd':
596
			services_radvd_configure();
597
			break;
598
		case 'captiveportal':
599
			$zone = $extras['zone'];
600
			killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal.pid");
601
			killbypid("{$g['varrun_path']}/lighty-{$zone}-CaptivePortal-SSL.pid");
602
			captiveportal_init_webgui_zonename($zone);
603
			break;
604
		case 'ntpd':
605
		case 'openntpd':
606
			system_ntp_configure();
607
			break;
608
		case 'bsnmpd':
609
			services_snmpd_configure();
610
			break;
611
		case 'dnsmasq':
612
			services_dnsmasq_configure();
613
			break;
614
		case 'dhcpd':
615
			services_dhcpd_configure();
616
			break;
617
		case 'igmpproxy':
618
			services_igmpproxy_configure();
619
			break;
620
		case 'miniupnpd':
621
			upnp_action('restart');
622
			break;
623
		case 'racoon':
624
			vpn_ipsec_force_reload();
625
			break;
626
		case 'openvpn':
627
			$vpnmode = $extras['vpnmode'];
628
			if ($vpnmode == "server" || $vpnmode == "client") {
629
				$id = $extras['id'];
630
				$configfile = "{$g['varetc_path']}/openvpn/{$vpnmode}{$id}.conf";
631
				if (file_exists($configfile))
632
					openvpn_restart_by_vpnid($vpnmode, $id);
633
			}
634
			break;
635
		case 'relayd':
636
			relayd_configure(true);
637
			break;
638
		default:
639
			restart_service($name);
640
			break;
641
	}
642
	return sprintf(gettext("%s has been restarted."),htmlspecialchars($name));
643
}
644

    
645
?>
(48-48/66)