]> git.ipfire.org Git - ipfire-2.x.git/blame - html/cgi-bin/shutdown.cgi
Merge remote-tracking branch 'dweismueller/vdr_vnsiserver5_new' into next
[ipfire-2.x.git] / html / cgi-bin / shutdown.cgi
CommitLineData
043cfbc0
AM
1#!/usr/bin/perl
2#
3# SmoothWall CGIs
4#
5# This code is distributed under the terms of the GPL
6#
7# (c) The SmoothWall Team
8#
9
10use strict;
11
12# enable only the following on debugging purpose
13#use warnings;
14#use CGI::Carp 'fatalsToBrowser';
15
16require '/var/ipfire/general-functions.pl';
17require "${General::swroot}/lang.pl";
18require "${General::swroot}/header.pl";
19
20my %cgiparams=();
21my $death = 0;
22my $rebirth = 0;
23
24&Header::showhttpheaders();
25
26$cgiparams{'ACTION'} = '';
27&Header::getcgihash(\%cgiparams);
28
29if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
30 $death = 1;
31 &General::log($Lang::tr{'shutting down ipfire'});
32 system '/usr/local/bin/ipfirereboot down';
33} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
34 $rebirth = 1;
35 &General::log($Lang::tr{'rebooting ipfire'});
36 system '/usr/local/bin/ipfirereboot boot';
37}
38if ($death == 0 && $rebirth == 0) {
39
40 &Header::openpage($Lang::tr{'shutdown control'}, 1, '');
41
42 &Header::openbigbox('100%', 'left');
43
44 print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
45
46 &Header::openbox('100%', 'left', );
47 print <<END
48<table width='100%'>
49<tr>
50 <td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
51 <td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
52</tr>
53</table>
54END
55 ;
56 &Header::closebox();
57
58} else {
59 my $message='';
60 my $title='';
61 my $refresh = "<meta http-equiv='refresh' content='5; URL=/cgi-bin/index.cgi' />";
62 if ($death) {
63 $title = $Lang::tr{'shutting down'};
64 $message = $Lang::tr{'ipfire has now shutdown'};
65 } else {
66 $title = $Lang::tr{'rebooting'};
67 $message = $Lang::tr{'ipfire has now rebooted'};
68 }
69 &Header::openpage($title, 0, $refresh);
70
71 &Header::openbigbox('100%', 'center');
72 print <<END
73<div align='center'>
74<table width='100%' bgcolor='#ffffff'>
75<tr><td align='center'>
f74ea481 76<br /><br /><img src='/images/IPFire.png' /><br /><br /><br />
043cfbc0
AM
77</td></tr>
78</table>
79<br />
80<font size='6'>$message</font>
81</div>
82END
83 ;
84}
85
86&Header::closebigbox();
87&Header::closepage();
88