Projet

Général

Profil

Télécharger (4,01 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / status_services.php @ 0fab7eb1

1
<?php
2
/*
3
    services_status.php
4
    Copyright (C) 2004, 2005 Scott Ullrich
5
    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
    INClUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19
    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
/*	
29
	pfSense_BUILDER_BINARIES:	/usr/local/sbin/openvpn	/usr/bin/killall	/bin/ps
30
	pfSense_MODULE:	services
31
*/
32

    
33
##|+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
require_once("guiconfig.inc");
41
require_once("service-utils.inc");
42
require_once("shortcuts.inc");
43

    
44
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
	sleep(5);
57
}
58

    
59
/* batch mode, allow other scripts to call this script */
60
if($_GET['batch'])
61
	exit;
62

    
63
$pgtitle = array(gettext("Status"),gettext("Services"));
64
include("head.inc");
65

    
66
?>
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
<div id="boxarea">
76
<table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="status services">
77
	<thead>
78
	<tr>
79
		<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
	</tr>
83
	</thead>
84
	<tbody>
85
<?php
86

    
87
$services = get_services();
88

    
89
if (count($services) > 0) {
90
	uasort($services, "service_name_compare");
91
	foreach($services as $service) {
92
		if (empty($service['name']))
93
			continue;
94
		if (empty($service['description']))
95
			$service['description'] = get_pkg_descr($service['name']);
96
		echo "<tr><td class=\"listlr\" width=\"20%\">" . $service['name'] . "</td>\n";
97
		echo "<td class=\"listr\" width=\"55%\">" . $service['description'] . "</td>\n";
98
		// if service is running then listr else listbg
99
		$bgclass = null;
100
		if (get_service_status($service))
101
			$bgclass = "listr";
102
		else
103
			$bgclass = "listbg";
104
		echo "<td class=\"" . $bgclass . "\" align=\"center\">" . get_service_status_icon($service, true, true) . "</td>\n";
105
		echo "<td valign=\"middle\" class=\"list nowrap\">" . get_service_control_links($service);
106
		$scut = get_shortcut_by_service_name($service['name']);
107
		if (!empty($scut)) {
108
			echo get_shortcut_main_link($scut, true, $service);
109
			echo get_shortcut_status_link($scut, true, $service);
110
			echo get_shortcut_log_link($scut, true);
111
		}
112
		echo "</td></tr>\n";
113
	}
114
} else {
115
	echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . " . </td></tr>\n";
116
}
117

    
118
?>
119
</tbody>
120
</table>
121
</div>
122
</form>
123
<?php include("fend.inc"); ?>
124
</body>
125
</html>
(199-199/254)