]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/shutdown.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2021 IPFire Development Team #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 # enable only the following on debugging purpose
26 #use CGI::Carp 'fatalsToBrowser';
28 require '/var/ipfire/general-functions.pl';
29 require "${General::swroot}/lang.pl";
30 require "${General::swroot}/header.pl";
32 ###--- HTML HEAD ---###
51 ###--- END HTML HEAD ---###
57 &Header
::showhttpheaders
();
59 $cgiparams{'ACTION'} = '';
60 &Header
::getcgihash
(\
%cgiparams);
62 if ($cgiparams{'ACTION'} eq "SHUTDOWN") {
64 &General
::log($Lang::tr
{'shutting down ipfire'});
65 &General
::system('/usr/local/bin/ipfirereboot', 'down');
66 } elsif ($cgiparams{'ACTION'} eq "REBOOT") {
68 &General
::log($Lang::tr
{'rebooting ipfire'});
69 &General
::system('/usr/local/bin/ipfirereboot', 'boot');
70 } elsif ($cgiparams{'ACTION'} eq "REBOOT_FSCK") {
72 &General
::log($Lang::tr
{'rebooting ipfire fsck'});
73 &General
::system('/usr/local/bin/ipfirereboot', 'bootfs');
76 if ($death == 0 && $rebirth == 0) {
78 &Header
::openpage
($Lang::tr
{'shutdown control'}, 1, $extraHead);
80 &Header
::openbigbox
('100%', 'left');
81 &Header
::openbox
('100%', 'left');
84 <form method="post" action="$ENV{'SCRIPT_NAME'}">
87 <td><button type="submit" name="ACTION" value="SHUTDOWN">$Lang::tr{'shutdown'}</button></td>
88 <td><button type="submit" name="ACTION" value="REBOOT">$Lang::tr{'reboot'}</button></td>
89 <td><button type="submit" name="ACTION" value="REBOOT_FSCK">$Lang::tr{'reboot fsck'}</button></td>
100 my $refresh = "<meta http-equiv='refresh' content='5; URL=/cgi-bin/index.cgi' />";
102 $title = $Lang::tr
{'shutting down'};
103 $message = $Lang::tr
{'ipfire has now shutdown'};
105 $title = $Lang::tr
{'rebooting'};
106 $message = $Lang::tr
{'ipfire has now rebooted'};
108 &Header
::openpage
($title, 0, $refresh);
110 &Header
::openbigbox
('100%', 'center');
113 <table width='100%' bgcolor='#ffffff'>
114 <tr><td align='center'>
115 <br /><br /><img src='/images/IPFire.png' /><br /><br /><br />
119 <font size='6'>$message</font>
125 &Header
::closebigbox
();
126 &Header
::closepage
();