Project

General

Profile

Download (3.79 KB) Statistics
| Branch: | Tag: | Revision:
1 a0e4cea2 Scott Ullrich
<?php
2
/*
3 ef09107d Colin Smith
    services_status.php
4
    Copyright (C) 2004, 2005 Scott Ullrich
5 a0e4cea2 Scott Ullrich
    All rights reserved.
6
7
    Redistribution and use in source and binary forms, with or without
8
    modification, are permitted provided that the following conditions are met:
9
10
    1. Redistributions of source code must retain the above copyright notice,
11
       this list of conditions and the following disclaimer.
12
13
    2. Redistributions in binary form must reproduce the above copyright
14
       notice, this list of conditions and the following disclaimer in the
15
       documentation and/or other materials provided with the distribution.
16
17
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 ef09107d Colin Smith
    INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19 a0e4cea2 Scott Ullrich
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
21
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
    POSSIBILITY OF SUCH DAMAGE.
27
*/
28 1d333258 Scott Ullrich
/*	
29
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/openvpn	/usr/bin/killall	/bin/ps
30
	pfSense_MODULE:	services
31
*/
32 a0e4cea2 Scott Ullrich
33 6b07c15a Matthew Grooms
##|+PRIV
34
##|*IDENT=page-status-services
35
##|*NAME=Status: Services page
36
##|*DESCR=Allow access to the 'Status: Services' page.
37
##|*MATCH=status_services.php*
38
##|-PRIV
39
40 e3c88b77 Ermal
require_once("guiconfig.inc");
41 44173def Ermal Lu?i
require_once("service-utils.inc");
42 a517a108 jmkizer
require_once("shortcuts.inc");
43 a0e4cea2 Scott Ullrich
44 8b88ac79 jim-p
if (!empty($_GET['service'])) {
45
	switch ($_GET['mode']) {
46
		case "restartservice":
47
			$savemsg = service_control_restart($_GET['service'], $_GET);
48
			break;
49
		case "startservice":
50
			$savemsg = service_control_start($_GET['service'], $_GET);
51
			break;
52
		case "stopservice":
53
			$savemsg = service_control_stop($_GET['service'], $_GET);
54
			break;
55
	}
56 cd72ded3 Timo Boettcher
	sleep(5);
57 a0e4cea2 Scott Ullrich
}
58
59
/* batch mode, allow other scripts to call this script */
60 246a887a Ermal
if($_GET['batch'])
61
	exit;
62 b9eadc0c Colin Smith
63 7f6ea91f Carlos Eduardo Ramos
$pgtitle = array(gettext("Status"),gettext("Services"));
64 4df96eff Scott Ullrich
include("head.inc");
65
66 a0e4cea2 Scott Ullrich
?>
67
68
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
69
<?php
70
include("fbegin.inc");
71
?>
72
<form action="status_services.php" method="post">
73
<?php if ($savemsg) print_info_box($savemsg); ?>
74
75 0f10aee4 Bill Marquette
<div id="boxarea">
76 bb877f44 Colin Fleming
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="status services">
77 a0995b8d jim-p
	<thead>
78 a9bc3b82 Scott Ullrich
	<tr>
79 a0995b8d jim-p
		<td class="listhdrr" align="center"><?=gettext("Service");?></td>
80
		<td class="listhdrr" align="center"><?=gettext("Description");?></td>
81
		<td class="listhdrr" align="center"><?=gettext("Status");?></td>
82 a9bc3b82 Scott Ullrich
	</tr>
83 a0995b8d jim-p
	</thead>
84
	<tbody>
85 a0e4cea2 Scott Ullrich
<?php
86
87 e48cdc01 jim-p
$services = get_services();
88 41997fbb Ermal Luci
89 246a887a Ermal
if (count($services) > 0) {
90 b2254c7f jim-p
	uasort($services, "service_name_compare");
91 25d3fbd5 Scott Ullrich
	foreach($services as $service) {
92 246a887a Ermal
		if (empty($service['name']))
93
			continue;
94
		if (empty($service['description']))
95
			$service['description'] = get_pkg_descr($service['name']);
96 391abfcf jim-p
		echo '<tr><td class="listlr" width="20%">' . $service['name'] . '</td>' . "\n";
97
		echo '<td class="listr" width="55%">' . $service['description'] . '</td>' . "\n";
98 36d1c798 jim-p
		echo get_service_status_icon($service, true, true);
99 bb877f44 Colin Fleming
		echo '<td valign="middle" class="list nowrap">';
100 b1460af3 jim-p
		echo get_service_control_links($service);
101 391abfcf jim-p
		$scut = get_shortcut_by_service_name($service['name']);
102
		if (!empty($scut)) {
103
			echo get_shortcut_main_link($scut, true, $service);
104
			echo get_shortcut_status_link($scut, true, $service);
105
			echo get_shortcut_log_link($scut, true);
106
		}
107 a0995b8d jim-p
		echo "</td></tr>\n";
108 a0e4cea2 Scott Ullrich
	}
109 b9eadc0c Colin Smith
} else {
110 39121390 bcyrill
	echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . ".</td></tr>\n";
111 b9eadc0c Colin Smith
}
112 cd72ded3 Timo Boettcher
113 a0e4cea2 Scott Ullrich
?>
114 a0995b8d jim-p
</tbody>
115 a0e4cea2 Scott Ullrich
</table>
116 12af52d9 Scott Ullrich
</div>
117 01d4b621 Ermal
</form>
118 a0e4cea2 Scott Ullrich
<?php include("fend.inc"); ?>
119
</body>
120
</html>