Project

General

Profile

Download (1.57 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php-cgi -f
2
<?php
3
/*
4
 * rc.initial.halt
5
 *
6
 * part of pfSense (https://www.pfsense.org)
7
 * Copyright (c) 2004 Bachman Kharazmi
8
 * Copyright (c) 2004-2013 BSD Perimeter
9
 * Copyright (c) 2013-2016 Electric Sheep Fencing
10
 * Copyright (c) 2014-2024 Rubicon Communications, LLC (Netgate)
11
 * All rights reserved.
12
 *
13
 * originally part of m0n0wall (http://m0n0.ch/wall)
14
 * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
15
 * All rights reserved.
16
 *
17
 * Licensed under the Apache License, Version 2.0 (the "License");
18
 * you may not use this file except in compliance with the License.
19
 * You may obtain a copy of the License at
20
 *
21
 * http://www.apache.org/licenses/LICENSE-2.0
22
 *
23
 * Unless required by applicable law or agreed to in writing, software
24
 * distributed under the License is distributed on an "AS IS" BASIS,
25
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26
 * See the License for the specific language governing permissions and
27
 * limitations under the License.
28
 */
29

    
30
/* parse the configuration and include all functions used below */
31
require_once("config.inc");
32
require_once("functions.inc");
33

    
34
$fp = fopen('php://stdin', 'r');
35

    
36
echo "\n" . sprintf(gettext("%s will shutdown and halt system. This may take a few minutes, depending on your hardware."), $g['product_label']) . "\n";
37
echo gettext("Do you want to proceed [y|n]?") . " ";
38

    
39
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
40
	$msg = sprintf(gettext("%s will shutdown and halt system now."), $g['product_label']);
41
	echo "\n" . $msg . "\n";
42
	notify_all_remote($msg);
43
	system_halt();
44
}
45

    
46
fclose($fp);
47

    
48
?>
(41-41/85)