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