Projet

Général

Profil

Télécharger (1,93 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / etc / rc.initial.halt @ master

1
#!/usr/local/bin/php -f
2
<?php
3
/* $Id$ */
4
/*
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
{$g['product_name']} will shutdown and halt system. This may take a few minutes, depending on your hardware.
44

    
45
Do you want to proceed [y|n]? 
46
EOD;
47

    
48
	if (strcasecmp(chop(fgets($fp)), "y") == 0) {
49

    
50
		echo <<<EOD
51

    
52
{$g['product_name']} will shutdown and halt system now.
53

    
54
EOD;
55

    
56
		system_halt();
57
	}
58
	
59
	fclose($fp);
60
	
61
?>
(57-57/103)