1 |
97a741af
|
Scott Ullrich
|
#!/usr/local/bin/php -f
|
2 |
|
|
<?php
|
3 |
1b8df11b
|
Bill Marquette
|
/* $Id$ */
|
4 |
97a741af
|
Scott Ullrich
|
/*
|
5 |
|
|
rc.initial.halt
|
6 |
|
|
part of pfSense (www.pfSense.com)
|
7 |
|
|
Copyright (C)2004 Bachman Kharazmi
|
8 |
|
|
|
9 |
|
|
Originally part of m0n0wall as rc.initial.reboot (http://m0n0.ch/wall)
|
10 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
All rights reserved.
|
12 |
|
|
|
13 |
|
|
Redistribution and use in source and binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
|
|
|
16 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
|
|
|
19 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
documentation and/or other materials provided with the distribution.
|
22 |
|
|
|
23 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
|
|
/* parse the configuration and include all functions used below */
|
36 |
|
|
require_once("config.inc");
|
37 |
|
|
require_once("functions.inc");
|
38 |
|
|
|
39 |
|
|
$fp = fopen('php://stdin', 'r');
|
40 |
|
|
|
41 |
|
|
echo <<<EOD
|
42 |
|
|
|
43 |
a86c158d
|
jim-p
|
{$g['product_name']} will shutdown and halt system. This may take a few minutes, depending on your hardware.
|
44 |
97a741af
|
Scott Ullrich
|
|
45 |
bbc3533f
|
Scott Ullrich
|
Do you want to proceed [y|n]?
|
46 |
97a741af
|
Scott Ullrich
|
EOD;
|
47 |
|
|
|
48 |
|
|
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
|
49 |
|
|
|
50 |
|
|
echo <<<EOD
|
51 |
|
|
|
52 |
5b6eac01
|
Scott Ullrich
|
{$g['product_name']} will shutdown and halt system now.
|
53 |
97a741af
|
Scott Ullrich
|
|
54 |
|
|
EOD;
|
55 |
|
|
|
56 |
|
|
system_halt();
|
57 |
|
|
}
|
58 |
31210184
|
Scott Ullrich
|
|
59 |
|
|
fclose($fp);
|
60 |
|
|
|
61 |
97a741af
|
Scott Ullrich
|
?>
|