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-2016 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved.
|
10
|
*
|
11
|
* originally part of m0n0wall (http://m0n0.ch/wall)
|
12
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
13
|
* All rights reserved.
|
14
|
*
|
15
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
16
|
* you may not use this file except in compliance with the License.
|
17
|
* You may obtain a copy of the License at
|
18
|
*
|
19
|
* http://www.apache.org/licenses/LICENSE-2.0
|
20
|
*
|
21
|
* Unless required by applicable law or agreed to in writing, software
|
22
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
23
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
24
|
* See the License for the specific language governing permissions and
|
25
|
* limitations under the License.
|
26
|
*/
|
27
|
|
28
|
/* parse the configuration and include all functions used below */
|
29
|
require_once("config.inc");
|
30
|
require_once("functions.inc");
|
31
|
|
32
|
$fp = fopen('php://stdin', 'r');
|
33
|
|
34
|
echo "\n" . sprintf(gettext("%s will shutdown and halt system. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
|
35
|
echo gettext("Do you want to proceed [y|n]?") . " ";
|
36
|
|
37
|
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
|
38
|
echo "\n" . sprintf(gettext("%s will shutdown and halt system now."), $g['product_name']) . "\n";
|
39
|
system_halt();
|
40
|
}
|
41
|
|
42
|
fclose($fp);
|
43
|
|
44
|
?>
|