Hinzugefügt:
authorms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 5 Jun 2006 17:35:00 +0000 (17:35 +0000)
committerms <ms@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 5 Jun 2006 17:35:00 +0000 (17:35 +0000)
  * HDDGraphs für mehrere Festplatten
  * Höhere Baudrate in pppsetup.cgi
Geändert:
  * Sprachen auf DE und EN reduziert.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@162 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

15 files changed:
config/cfgroot/header.pl
config/cron/crontab
doc/packages-list.txt
html/cgi-bin/graphs.cgi
html/cgi-bin/pppsetup.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
langs/list
make.sh
src/ROOTFILES.i386
src/misc-progs/Makefile
src/rc.d/rc.sysinit
src/scripts/hddshutdown [new file with mode: 0644]
src/scripts/hddshutdown-state [new file with mode: 0644]
src/scripts/makegraphs

index 3d84c1c..d07a213 100644 (file)
@@ -159,13 +159,13 @@ sub genmenu {
     $substatus->{'01.systemstatus'} = {
                                 'caption' => $tr{'sssystem status'},
                                 'uri' => '/cgi-bin/status.cgi',
-                                'title' => "$tr{'system status information'}",
+                                'title' => "$tr{'sssystem status'}",
                                 'enabled' => 1,
                                 };
     $substatus->{'02.networkstatus'} = {
                                'caption' => $tr{'ssnetwork status'},
                                'uri' => '/cgi-bin/netstatus.cgi',
-                               'title' => "$tr{'network status information'}",
+                               'title' => "$tr{'ssnetwork status'}",
                                'enabled' => 1,
                                };
     $substatus->{'03.systemgraphs'} = {
@@ -179,21 +179,33 @@ sub genmenu {
                                'caption' => $tr{'sstraffic graphs'},
                                'uri' => '/cgi-bin/graphs.cgi',
                                'vars' => 'graph=network',
-                               'title' => "$tr{'network traffic graphs'}",
+                               'title' => "$tr{'sstraffic graphs'}",
                                'enabled' => 1,
                                };
     $substatus->{'05.proxygraphs'} = {
                                'caption' => $tr{'ssproxy graphs'},
                                'uri' => '/cgi-bin/proxygraphs.cgi',
-                               'title' => "$tr{'proxy access graphs'}",
+                               'title' => "$tr{'ssproxy graphs'}",
                                'enabled' => 1,
                                };
-    $substatus->{'06.connections'} = {
+    $substatus->{'06.fwhits'} = {
+                                 'caption' => 'Firewallhits',
+                                 'uri' => '/cgi-bin/fwhits.cgi',
+                                 'title' => "IPFire Firewallhits",
+                                'enabled' => 1,
+                                 };
+    $substatus->{'07.connections'} = {
                                'caption' => $tr{'connections'},
                                'uri' => '/cgi-bin/connections.cgi',
                                'title' => "$tr{'connections'}",
                                'enabled' => 1,
                                };
+    $substatus->{'08.nettraf'} = {
+                                 'caption' => $tr{'sstraffic'},
+                                 'uri' => '/cgi-bin/traffic.cgi',
+                                 'title' => "$tr{'sstraffic'}",
+                                'enabled' => 1,
+                                 };
     $substatus->{'99.iptfilters'} = {
                                'caption' => $tr{'iptfilters iptable rules'},
                                'uri' => '/cgi-bin/iptfilters.cgi',
@@ -204,72 +216,65 @@ sub genmenu {
     my %subnetworkhash = ();
     my $subnetwork = \%subnetworkhash;
 
-    $subnetwork->{'01.dialup'} = {
+    $subnetwork->{'01.proxy'} = {'caption' => 'Webproxy',
+                               'uri' => '/cgi-bin/proxy.cgi',
+                               'title' => "Webproxy",
+                               'enabled' => 1,
+                               };
+    $subnetwork->{'02.urlfilter'} = {'caption' => 'URL-Filter',
+                               'uri' => '/cgi-bin/urlfilter.cgi',
+                               'title' => "URL-Filter",
+                               'enabled' => 1,
+                               };
+    $subnetwork->{'03.dhcp'} = {'caption' => $tr{'dhcp server'},
+                                'uri' => '/cgi-bin/dhcp.cgi',
+                                'title' => "$tr{'dhcp server'}",
+                                'enabled' => 1,
+                                };
+    $subnetwork->{'04.dialup'} = {
                                  'caption' => $tr{'alt dialup'},
                                  'uri' => '/cgi-bin/pppsetup.cgi',
-                                 'title' => "$tr{'dialup settings'}",
+                                 'title' => "$tr{'alt dialup'}",
                                  'enabled' => 1,
                                  };
-    $subnetwork->{'02.hosts'} = {
+    $subnetwork->{'05.hosts'} = {
                                 'caption' => $tr{'edit hosts'},
                                 'uri' => '/cgi-bin/hosts.cgi',
-                                'title' => "$tr{'host configuration'}",
+                                'title' => "$tr{'edit hosts'}",
                                 'enabled' => 1,
                                 };
-    $subnetwork->{'03.upload'} = {
+    $subnetwork->{'06.upload'} = {
                                  'caption' => $tr{'upload'},
                                  'uri' => '/cgi-bin/upload.cgi',
-                                 'title' => "$tr{'firmware upload'}",
+                                 'title' => "$tr{'upload'}",
                                  'enabled' => 0,
                                  };
-    $subnetwork->{'04.aliases'} = {
+    $subnetwork->{'07.aliases'} = {
                                  'caption' => $tr{'aliases'},
                                  'uri' => '/cgi-bin/aliases.cgi',
-                                 'title' => "$tr{'external aliases configuration'}",
+                                 'title' => "$tr{'aliases'}",
                                  'enabled' => 1,
                                  };
-    $subnetwork->{'05.nettraf'} = {
-                                 'caption' => $tr{'sstraffic'},
-                                 'uri' => '/cgi-bin/traffic.cgi',
-                                 'title' => "$tr{'sstraffic'}",
-                                'enabled' => 1,
-                                 };
-    $subnetwork->{'06.fwhits'} = {
-                                 'caption' => 'Firewallhits',
-                                 'uri' => '/cgi-bin/fwhits.cgi',
-                                 'title' => "IPFire Firewallhits",
-                                'enabled' => 1,
-                                 };
-    $subnetwork->{'07.openvpn'} = {
-                                 'caption' => 'OpenVPN',
-                                 'uri' => '/cgi-bin/ovpnmain.cgi',
-                                 'title' => "$tr{'virtual private networking'}",
-                                'enabled' => 1,
-                                 };
-    $subnetwork->{'08.ipsec'} = {
-                                 'caption' => 'IPSec',
-                                 'uri' => '/cgi-bin/vpnmain.cgi',
-                                 'title' => "$tr{'virtual private networking'}",
-                                 'enabled' => 1,
-                                 };
-
 
     my %subserviceshash = ();
     my $subservices = \%subserviceshash;
 
-    $subservices->{'01.proxy'} = {'caption' => $tr{'proxy'},
-                               'uri' => '/cgi-bin/proxy.cgi',
-                               'title' => "HTTP: $tr{'web proxy configuration'}",
-                               'enabled' => 1,
-                               };
-    $subservices->{'02.dhcp'} = {'caption' => $tr{'dhcp server'},
-                                'uri' => '/cgi-bin/dhcp.cgi',
-                                'title' => "$tr{'dhcp configuration'}",
-                                'enabled' => 1,
-                                };
+
+    $subservices->{'01.openvpn'} = {
+                               'caption' => 'OpenVPN',
+                               'uri' => '/cgi-bin/ovpnmain.cgi',
+                               'title' => "$tr{'virtual private networking'}",
+                              'enabled' => 1,
+                               };
+    $subservices->{'02.ipsec'} = {
+                               'caption' => 'IPSec',
+                               'uri' => '/cgi-bin/vpnmain.cgi',
+                               'title' => "$tr{'virtual private networking'}",
+                               'enabled' => 1,
+                               };
     $subservices->{'03.dyndns'} = {'caption' => $tr{'dynamic dns'},
                                'uri' => '/cgi-bin/ddns.cgi',
-                               'title' => "$tr{'dynamic dns client'}",
+                               'title' => "$tr{'dynamic dns'}",
                                'enabled' => 1,
                                };
     $subservices->{'04.time'} = {'caption' => $tr{'time server'},
@@ -279,7 +284,7 @@ sub genmenu {
                                };
     $subservices->{'05.qos'} = {'caption' => 'Quality of Service',
                                'uri' => '/cgi-bin/qos.cgi',
-                               'title' => "$tr{'traffic shaping settings'}",
+                               'title' => "Quality of Service",
                                'enabled' => 1,
                                };
     $subservices->{'06.ids'} = {'caption' => $tr{'intrusion detection'},
@@ -289,6 +294,7 @@ sub genmenu {
                                };
 
 
+
     my %subfirewallhash = ();
     my $subfirewall = \%subfirewallhash;
 
@@ -296,13 +302,13 @@ sub genmenu {
     $subfirewall->{'01.dnat'} = {
                                 'caption' => $tr{'ssport forwarding'},
                                 'uri' => '/cgi-bin/portfw.cgi',
-                                'title' => "$tr{'port forwarding configuration'}",
+                                'title' => "$tr{'ssport forwarding'}",
                                 'enabled' => 1,
                                 };
     $subfirewall->{'02.xtaccess'} = {
                                 'caption' => $tr{'external access'},
                                 'uri' => '/cgi-bin/xtaccess.cgi',
-                                'title' => "$tr{'external access configuration'}",
+                                'title' => "$tr{'external access'}",
                                 'enabled' => 1,
                                 };
     $subfirewall->{'03.wireless'} = {
@@ -314,7 +320,7 @@ sub genmenu {
     $subfirewall->{'04.dmz'} = {
                                'caption' => $tr{'ssdmz pinholes'},
                                'uri' => '/cgi-bin/dmzholes.cgi',
-                               'title' => "$tr{'dmz pinhole configuration'}",
+                               'title' => "$tr{'ssdmz pinhole'}",
                                'enabled' => 1,
                                 };
     $subfirewall->{'05.outgoing'} = {
@@ -323,6 +329,12 @@ sub genmenu {
                                'title' => "$tr{'outgoing firewall'}",
                                'enabled' => 1,
                                };
+    $subfirewall->{'06.fwopts'} = {
+                               'caption' => $tr{'options fw'},
+                               'uri' => '/cgi-bin/optionsfw.cgi',
+                               'title' => "$tr{'options fw'}",
+                               'enabled' => 1,
+                                };
     
     my %sublogshash = ();
     my $sublogs = \%sublogshash;
@@ -339,17 +351,17 @@ sub genmenu {
                                 };
     $sublogs->{'03.proxy'} = {'caption' => $tr{'proxy logs'},
                                 'uri' => '/cgi-bin/logs.cgi/proxylog.dat',
-                                'title' => "$tr{'proxy log viewer'}",
+                                'title' => "$tr{'proxy log'}",
                                 'enabled' => 1
                                 };
     $sublogs->{'04.firewall'} = {'caption' => $tr{'firewall logs'},
                                 'uri' => '/cgi-bin/logs.cgi/firewalllog.dat',
-                                'title' => "$tr{'firewall log viewer'}",
+                                'title' => "$tr{'firewall logs'}",
                                 'enabled' => 1
                                 };
     $sublogs->{'05.ids'} = {'caption' => $tr{'ids logs'},
                                'uri' => '/cgi-bin/logs.cgi/ids.dat',
-                               'title' => "$tr{'intrusion detection system log viewer'}",
+                               'title' => "$tr{'ids logs'}",
                                'enabled' => 1
                                };
     $sublogs->{'07.urlfilter'} = {
@@ -365,12 +377,12 @@ sub genmenu {
                                };
     $sublogs->{'09.system'} = {'caption' => $tr{'system logs'},
                                'uri' => '/cgi-bin/logs.cgi/log.dat',
-                               'title' => "$tr{'system log viewer'}",
+                               'title' => "$tr{'system log'}",
                                'enabled' => 1
                                };
     $sublogs->{'10.userlog'} = {'caption' => $tr{'user proxy logs'},
                                'uri' => '/cgi-bin/logs.cgi/userlog.dat',
-                               'title' => "$tr{'user log viewer'}",
+                               'title' => "$tr{'user log'}",
                                'enabled' => 1
                                };
 
index f51a686..9b08f06 100644 (file)
@@ -31,3 +31,6 @@ HOME=/
 01 0 * * *     /usr/local/bin/logwatch > /var/log/logwatch/`date -I -d yesterday`; \
                LOGWATCH_KEEP=$(sed -ne 's/^LOGWATCH_KEEP=\([0-9]\+\)$/\1/p' /var/ipfire/logging/settings); \
                find /var/log/logwatch/ -ctime +${LOGWATCH_KEEP=56} -exec rm -f '{}' ';'
+
+# hddshutdown
+00 * * * *     /usr/local/bin/hddshutdown >/dev/null
\ No newline at end of file
index 85e547b..752c2e8 100644 (file)
   * snort-2.3.3
   * spandsp-0.0.2pre25
   * speedtouch-1.2
-  * squid-2.5.STABLE13_1st
   * squid-2.5.STABLE14
   * squid-graph-3.1
   * startscripts
index f19e5a6..8f590d3 100644 (file)
@@ -40,6 +40,25 @@ if ($cgigraphs[1] =~ /(network|GREEN|BLUE|ORANGE|RED|lq)/) {
 } else {
        &Header::openpage($Lang::tr{'system graphs'}, 1, '');
 }
+
+sub diskbox {
+ my $disk = $_[0];
+    if (-e "$graphdir/disk-$disk-day.png") {
+  
+         &Header::openbox('100%', 'center', "Disk /dev/$disk $Lang::tr{'graph'}");
+         my $ftime = localtime((stat("$graphdir/disk-$disk-day.png"))[9]);
+         print "<center><b>$Lang::tr{'the statistics were last updated at'}: $ftime</b></center><br />\n";
+         print "<a href='/cgi-bin/graphs.cgi?graph=disk-$disk'>";
+         print "<img src='/graphs/disk-$disk-day.png' border='0' />";
+         print "</a>";
+         print "<br />\n";
+         if (-e "/usr/local/bin/hddshutdown-state") {
+           system("/usr/local/bin/hddshutdown-state $disk");
+         }     
+        &Header::closebox();
+  }
+}
+
 &Header::openbigbox('100%', 'left');
 
 if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
@@ -143,6 +162,15 @@ if ($cgigraphs[1] =~ /(GREEN|BLUE|ORANGE|RED|lq|cpu|memory|swap|disk)/) {
        }
        print "<br />\n";
        &Header::closebox();
+
+    diskbox("hda");
+    diskbox("hdb");
+    diskbox("hdc");
+    diskbox("hdd");
+    diskbox("hde");
+    diskbox("hdf");
+    diskbox("hdg");
+    diskbox("hdh");
 }
 
 &Header::closebigbox();
index 66f8c92..aca632b 100644 (file)
@@ -64,7 +64,7 @@ elsif ($pppsettings{'ACTION'} eq $Lang::tr{'save'})
        if ($pppsettings{'TYPE'} =~ /^(modem|serial|isdn)$/ && $pppsettings{'COMPORT'} !~ /^(ttyS0|ttyS1|ttyS2|ttyS3|ttyS4|usb\/ttyACM0|usb\/ttyACM1|usb\/ttyACM2|usb\/ttyACM3|isdn1|isdn2)$/) {
                $errormessage = $Lang::tr{'invalid input'};
                goto ERROR; }
-       if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400)$/) {
+       if ($pppsettings{'TYPE'} =~ /^(modem|serial)$/ && $pppsettings{'DTERATE'} !~ /^(9600|19200|38400|57600|115200|230400|460800)$/) {
                $errormessage = $Lang::tr{'invalid input'};
                goto ERROR; }
        if ($pppsettings{'TYPE'} eq 'modem' && $pppsettings{'DIALMODE'} !~ /^(T|P)$/) {
@@ -321,7 +321,7 @@ my $c=0;
 for ($c = 1; $c <= $maxprofiles; $c++)
 {
        %temppppsettings = ();
-       $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty'};
+       $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty profile'};
        &General::readhash("${General::swroot}/ppp/settings-$c", \%temppppsettings);
        $profilenames[$c] = $temppppsettings{'PROFILENAME'};
 }
@@ -381,6 +381,7 @@ $selected{'DTERATE'}{'38400'} = '';
 $selected{'DTERATE'}{'57600'} = '';
 $selected{'DTERATE'}{'115200'} = '';
 $selected{'DTERATE'}{'230400'} = '';
+$selected{'DTERATE'}{'460800'} = '';
 $selected{'DTERATE'}{$pppsettings{'DTERATE'}} = "selected='selected'";
 
 $checked{'SPEAKER'}{'off'} = '';
@@ -594,6 +595,7 @@ END
                <option value='57600' $selected{'DTERATE'}{'57600'}>57600</option>
                <option value='115200' $selected{'DTERATE'}{'115200'}>115200</option>
                <option value='230400' $selected{'DTERATE'}{'230400'}>230400</option>
+               <option value='460800' $selected{'DTERATE'}{'460800'}>460800</option>
        </select></td>
 </tr>
 END
index c0738a7..19712fb 100644 (file)
 'advproxy update notification' => 'Update-Benachrichtigung!',
 'advproxy update information' => 'Eine aktualisierte Version steht zum Download bereit. Besuchen Sie <a href="http://www.advproxy.net" target="_blank">http://www.advproxy.net</a> für weitere Informationen.',
 'linkq' => 'Verbindungsqualität',
+'empty profile' => 'Unbenannt',
 
 ); 
 
index 14f6540..7022f23 100644 (file)
 'advproxy update notification' => 'Update notification!',
 'advproxy update information' => 'There is an updated version available for download. Visit <a href="http://www.advproxy.net" target="_blank">http://www.advproxy.net</a> for more information.',
 'linkq' => 'Link Quality',
+'empty profile' => 'empty',
 
 );
index e1b7086..ee223dd 100644 (file)
@@ -1,29 +1,2 @@
-bz:Brazilian Portuguese:Portugu&ecirc;s-Brasil
-zh:Chinese Simplified:&#20013;&#25991;-&#31616;
-zt:Chinese Traditional:&#20013;&#25991;-&#32321;
-cs:Czech:&#268;e&#353;tina
-da:Danish:Dansk
-nl:Dutch:Nederlands
 en:English:English
-fi:Finnish:Suomi
-fr:French:Fran&ccedil;ais
 de:German:Deutsch
-el:Greek:Ellinika
-hu:Hungarian:Magyar
-it:Italian:Italiano
-lt:Lithuanian:Lietuvi&#371;
-no:Norwegian:Norsk
-fa:Persian:Farsi
-pl:Polish:Polski
-pt:Portuguese:Portugu&ecirc;s
-ro:Romanian:Rom&acirc;n&#259;
-ru:Russian:Russkij
-sk:Slovak:Slovenčina
-sl:Slovenian:Slovinsko
-so:Somali:Soomali
-es:Spanish:Espa&ntilde;ol
-la:Spanish Latino:Espa&ntilde;ol latinoamericano
-sv:Swedish:Svenska
-th:Thai:&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;
-tr:Turkish:T&uuml;rk&ccedil;e
-vi:Vietnamese:Ti&#7871;ng Vi&#7879;t
diff --git a/make.sh b/make.sh
index cc7a80f..fe8fa3b 100644 (file)
--- a/make.sh
+++ b/make.sh
@@ -694,9 +694,9 @@ buildipcop() {
   ipcopmake bridge-utils
   echo -ne "`date -u '+%b %e %T'`: Building ### Mailserver ### \n" | tee -a $LOGFILE
   ipcopmake postfix
+  ipcopmake procmail
   ipcopmake fetchmail
   ipcopmake cyrusimap
-  ipcopmake procmail
   ipcopmake mailx
   ipcopmake clamav
   ipcopmake razor
index e064e7c..41eec05 100644 (file)
@@ -1363,7 +1363,7 @@ usr/local/bin/settime
 usr/local/bin/timecheck
 usr/local/bin/timecheckctrl
 #usr/local/bin/tunerrd.pl
-#usr/local/bin/updatelists.pl
+usr/local/bin/logtailfwhits
 usr/local/bin/resetusb
 #usr/local/doc
 #usr/local/etc
@@ -22522,6 +22522,7 @@ usr/local/bin/restartsnort
 usr/local/bin/restartsquid
 usr/local/bin/restartssh
 usr/local/bin/restartsyslogd
+usr/local/bin/restartwireless
 usr/local/bin/setaliases
 usr/local/bin/setdate
 usr/local/bin/setdmzholes
index 06c98ea..ce04fb1 100644 (file)
@@ -9,8 +9,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess restartdhcp restartsno
        ipfirebkcfg ipfirerscfg installpackage installfcdsl ipsecctrl \
        setaliases ipfirebackup restartntpd \
        restartapplejuice setdate rebuildhosts \
-       restartsyslogd logwatch openvpnctrl timecheckctrl
-       # restartwireless
+       restartsyslogd logwatch openvpnctrl timecheckctrl restartwireless
 
 install : all
        install -m 755  $(PROGS) /usr/local/bin
index 544873b..21e589a 100644 (file)
@@ -236,6 +236,34 @@ if [ -e /var/log/rrd/disk.rrd ]; then
        echo "Adjusting graphs to compensate for boot"
        /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk.rrd","-t","readsect:writesect","N:U:U");'
 fi
+if [ -e /var/log/rrd/disk-hda.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hda.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdb.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdb.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdc.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdc.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdd.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdd.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hde.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hde.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdf.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdf.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdg.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdg.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /var/log/rrd/disk-hdh.rrd ]; then
+       /usr/bin/perl -e 'use RRDs;RRDs::update("/var/log/rrd/disk-hdh.rrd","-t","readsect:writesect:sleeping","N:U:U:U");'
+fi
+if [ -e /tmp/hddshutdown-stat ] ; then
+  rm /tmp/hddshutdown-*"
+fi
+/usr/local/bin/hddshutdown
 
 echo "Starting crond"
 /usr/sbin/fcron
diff --git a/src/scripts/hddshutdown b/src/scripts/hddshutdown
new file mode 100644 (file)
index 0000000..ebd5257
--- /dev/null
@@ -0,0 +1,117 @@
+#!/usr/bin/perl
+#
+# IPFire HDD Shutdown
+#
+# This code is distributed under the terms of the GPL
+#
+# 13.05.2006 Arne Fitzenreiter
+#
+
+# begin
+
+sub shutdown_hdd {
+
+       my $hdd = $_[0];
+       my $hdddev = "/dev/$_[0]";
+
+       my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
+               $atime, $mtime, $ctime, $blksize, $blocks) = stat($hdddev);
+
+       my $major = $rdev >> 8;
+       my $minor = ($rdev & 0xFF) >> 6;
+
+       open STAT, "/tmp/hddshutdown-stat";
+       my @diskstat = <STAT>;
+       close (STAT);
+       foreach my $line (@diskstat)
+       {
+               chomp ($line);
+               my @temp = split(/\:\ /,$line);
+               if ($temp[1]) {
+                       my @devicestat = split(/\ /,$temp[1]);
+                       foreach my $stats (@devicestat)
+                       {
+                               chomp ($stats);
+                               my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
+                               if ($major eq $fields[1] and $minor eq $fields[2])
+                               {
+                                       $lastreadwritereq = $fields[3];
+                               }
+                       }
+               }
+       }
+
+       open STAT, "/proc/stat";
+       my @diskstat = <STAT>;
+       close (STAT);
+       foreach my $line (@diskstat)
+       {
+               chomp ($line);
+               my @temp = split(/\:\ /,$line);
+               if ($temp[1]) {
+                       my @devicestat = split(/\ /,$temp[1]);
+                       foreach my $stats (@devicestat)
+                       {
+                               chomp ($stats);
+                               my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
+                               if ($major eq $fields[1] and $minor eq $fields[2])
+                               {
+                                       $readwritereq = $fields[3];
+                               }
+                       }
+               }
+       }
+
+       if (! -e "/tmp/hddshutdown-$hdd" ) { system("echo 0 > /tmp/hddshutdown-$hdd"); }
+
+       if ($readwritereq==$lastreadwritereq) {
+               open STAT,"/tmp/hddshutdown-$hdd";
+               my $lastsleepstate = <STAT>;
+               close (STAT);
+               if (! ($lastsleepstate==$readwritereq)) { 
+                       system("hdparm -y $hdddev");
+                       system("logger -t ipcop Shuting down $hdddev !");
+                       system("echo $readwritereq > /tmp/hddshutdown-$hdd");
+               }       
+       }               
+       
+}
+
+if ( -e "/tmp/hddshutdown-stat" ) {
+  if (open STAT,"/dev/hda") {
+     close STAT; 
+  shutdown_hdd("hda");
+  }
+  if (open STAT,"/dev/hdb") {
+     close STAT; 
+  shutdown_hdd("hdb");
+  }
+  if (open STAT,"/dev/hdc") {
+     close STAT; 
+  shutdown_hdd("hdc");
+  }
+  if (open STAT,"/dev/hdd") {
+     close STAT; 
+  shutdown_hdd("hdd");
+  }
+  if (open STAT,"/dev/hde") {
+     close STAT; 
+  shutdown_hdd("hde");
+  }
+  if (open STAT,"/dev/hdf") {
+     close STAT; 
+  shutdown_hdd("hdf");
+  }
+  if (open STAT,"/dev/hdg") {
+     close STAT; 
+  shutdown_hdd("hdg");
+  }
+  if (open STAT,"/dev/hdh") {
+     close STAT; 
+  shutdown_hdd("hdh");
+  }
+
+}
+
+system("cp /proc/stat /tmp/hddshutdown-stat");
+# end
diff --git a/src/scripts/hddshutdown-state b/src/scripts/hddshutdown-state
new file mode 100644 (file)
index 0000000..d5cf333
--- /dev/null
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+#
+# IPFire HDD Shutdown state reader
+#
+# This code is distributed under the terms of the GPL
+#
+# 11.05.2006 Arne Fitzenreiter
+#
+
+# begin
+
+my $hdd = @ARGV[0];
+my $hdddev = "/dev/$hdd";
+
+my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
+       $atime, $mtime, $ctime, $blksize, $blocks) = stat($hdddev);
+
+my $major = $rdev >> 8;
+my $minor = ($rdev & 0xFF) >> 6;
+
+       open STAT, "/proc/stat";
+       my @diskstat = <STAT>;
+       close (STAT);
+       foreach my $line (@diskstat)
+       {
+               chomp ($line);
+               my @temp = split(/\:\ /,$line);
+               if ($temp[1]) {
+                       my @devicestat = split(/\ /,$temp[1]);
+                       foreach my $stats (@devicestat)
+                       {
+                               chomp ($stats);
+                               my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
+                               if ($major eq $fields[1] and $minor eq $fields[2])
+                               {
+                                       $readwritereq = $fields[3];
+                               }
+                       }
+               }
+       }
+
+       if (! -e "/tmp/hddshutdown-$hdd" ) { 
+               print"<B>Disk $hdddev status:</B> unknown"
+               
+       }
+
+       if ( -e "/tmp/hddshutdown-$hdd" ) {
+               open STAT,"/tmp/hddshutdown-$hdd";
+               my $lastsleepstate = <STAT>;
+               close (STAT);
+               my $ftime = localtime((stat("/tmp/hddshutdown-$hdd"))[9]);
+               if (! ($lastsleepstate==$readwritereq)) {
+                       print"<B>Disk $hdddev status: <font color=#FF0000>active</font></B>";
+               }
+               if ( ($lastsleepstate==$readwritereq)) {
+                       print"<B>Disk $hdddev status: <font color=#00FF00>standby</font></B> (since $ftime)";
+               }
+              
+}              
+       
+
+
+# end
index 1120fd8..1ea6dc3 100644 (file)
@@ -341,6 +341,107 @@ sub updatediskdata {
        }
 }
 
+sub updatediskgraphnew {
+       my $disk      = $_[0];
+       my $period    = $_[1];
+
+       RRDs::graph ("$graphs/disk-$disk-$period.png",
+               "--start", "-1$period", "-aPNG", "-i", "-z",
+               "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r",
+               "--color", "SHADEA#EAE9EE",
+               "--color", "SHADEB#EAE9EE",
+               "--color", "BACK#FFFFFF",
+               "-t $tr{'disk access per'} $tr{$period}",
+               "DEF:read=$rrdlog/disk-$disk.rrd:readsect:AVERAGE",
+               "DEF:write=$rrdlog/disk-$disk.rrd:writesect:AVERAGE",
+               "DEF:sleep=$rrdlog/disk-$disk.rrd:sleeping:AVERAGE",
+               "CDEF:sl_state=sleep,INF,*",
+
+                "AREA:sl_state#a0a0a0:disk standby\\j",
+               "AREA:read#0000FF:$tr{'sectors read from disk per second'}\\j",
+               "STACK:write#00FF00:$tr{'sectors written to disk per second'}\\j",
+       
+               "GPRINT:read:MAX:$tr{'maximal'} $tr{'read sectors'}\\:%8.0lf",
+               "GPRINT:read:AVERAGE:$tr{'average'} $tr{'read sectors'}\\:%8.0lf",
+               "GPRINT:read:LAST:$tr{'current'} $tr{'read sectors'}\\:%8.0lf\\j",
+               "GPRINT:write:MAX:$tr{'maximal'} $tr{'written sectors'}\\:%8.0lf",
+               "GPRINT:write:AVERAGE:$tr{'average'} $tr{'written sectors'}\\:%8.0lf",
+               "GPRINT:write:LAST:$tr{'current'} $tr{'written sectors'}\\:%8.0lf\\j");
+       $ERROR = RRDs::error;
+       print "Error in RRD::graph for disk-$disk: $ERROR\n" if $ERROR;
+}
+
+sub updatediskdatanew {
+       my $disk = $_[0];
+
+       my ($readwritereq, $readreq, $readsect, $writereq, $writesect);
+       if ( ! -e "$rrdlog/disk-$disk.rrd") {
+               RRDs::create ("$rrdlog/disk-$disk.rrd", "--step=300",
+                       "DS:readsect:COUNTER:600:0:5000000000",
+                       "DS:writesect:COUNTER:600:0:5000000000",
+                       "DS:sleeping:GAUGE:600:0:1",
+                       "RRA:AVERAGE:0.5:1:576",
+                       "RRA:AVERAGE:0.5:6:672",
+                       "RRA:AVERAGE:0.5:24:732",
+                       "RRA:AVERAGE:0.5:144:1460");
+               $ERROR = RRDs::error;
+               print "Error in RRD::create for disk-$disk: $ERROR\n" if $ERROR;
+       }
+
+       my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
+               $atime, $mtime, $ctime, $blksize, $blocks) = stat("/dev/$disk");
+
+       my $major = $rdev >> 8;
+       my $minor = ($rdev & 0xFF) >>6;
+
+       open STAT, "/proc/stat";
+       my @diskstat = <STAT>;
+       close (STAT);
+       foreach my $line (@diskstat)
+       {
+               chomp ($line);
+               my @temp = split(/\:\ /,$line);
+               if ($temp[1]) {
+                       my @devicestat = split(/\ /,$temp[1]);
+                       foreach my $stats (@devicestat)
+                       {
+                               chomp ($stats);
+                               my @fields = split(/\((\d+),(\d+)\):\((\d+),(\d+),(\d+),(\d+),(\d+)/,$stats);
+                               if ($major eq $fields[1] and $minor eq $fields[2])
+                               {
+                                       $readwritereq = $fields[3];
+                                       $readreq      = $fields[4];
+                                       $readsect     = $fields[5];
+                                       $writereq     = $fields[6];
+                                       $writesect    = $fields[7];
+                               }
+                       }
+               }
+       }
+
+       my $sleeping=0;
+       my $lastsleepstate=0;
+
+       if ( -e "/tmp/hddshutdown-$disk" ) {
+               open STAT,"/tmp/hddshutdown-$disk";
+               $lastsleepstate = <STAT>;
+               close (STAT);
+               if ($lastsleepstate==$readwritereq) {
+                       $sleeping=1;
+               }
+       }       
+
+       if ($readsect && $writesect) {
+               RRDs::update ("$rrdlog/disk-$disk.rrd",
+                       "-t", "readsect:writesect:sleeping",
+                       "N:$readsect:$writesect:$sleeping");
+               $ERROR = RRDs::error;
+               print "Error in RRD::update for disk-$disk: $ERROR\n" if $ERROR;
+       } else {
+               print "Error in RRD::update for disk-$disk: no data available\n";
+       }
+}
+
 sub updateifgraph {
        my $interface = $_[0];
        my $period    = $_[1];
@@ -627,6 +728,110 @@ updatediskgraph ("week");
 updatediskgraph ("month");
 updatediskgraph ("year");
 
+if (open STAT,"/dev/hda") {
+  close STAT; 
+  updatediskdatanew ("hda");
+  updatediskgraphnew ("hda","day");
+  updatediskgraphnew ("hda","week");
+  updatediskgraphnew ("hda","month");
+  updatediskgraphnew ("hda","year");
+} else {
+  if (-e "$graphs/disk-hda-day.png") {
+     system("rm $graphs/disk-hda-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdb") {
+  close STAT; 
+  updatediskdatanew ("hdb");
+  updatediskgraphnew ("hdb","day");
+  updatediskgraphnew ("hdb","week");
+  updatediskgraphnew ("hdb","month");
+  updatediskgraphnew ("hdb","year");
+} else {
+  if (-e "$graphs/disk-hdb-day.png") {
+     system("rm $graphs/disk-hdb-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdc") {
+  close STAT; 
+  updatediskdatanew ("hdc");
+  updatediskgraphnew ("hdc","day");
+  updatediskgraphnew ("hdc","week");
+  updatediskgraphnew ("hdc","month");
+  updatediskgraphnew ("hdc","year");
+} else {
+  if (-e "$graphs/disk-hdc-day.png") {
+     system("rm $graphs/disk-hdc-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdd") {
+  close STAT; 
+  updatediskdatanew ("hdd");
+  updatediskgraphnew ("hdd","day");
+  updatediskgraphnew ("hdd","week");
+  updatediskgraphnew ("hdd","month");
+  updatediskgraphnew ("hdd","year");
+} else {
+  if (-e "$graphs/disk-hdd-day.png") {
+     system("rm $graphs/disk-hdd-day.png");
+  }
+}
+
+if (open STAT,"/dev/hde") {
+  close STAT; 
+  updatediskdatanew ("hde");
+  updatediskgraphnew ("hde","day");
+  updatediskgraphnew ("hde","week");
+  updatediskgraphnew ("hde","month");
+  updatediskgraphnew ("hde","year");
+} else {
+  if (-e "$graphs/disk-hde-day.png") {
+     system("rm $graphs/disk-hde-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdf") {
+  close STAT; 
+  updatediskdatanew ("hdf");
+  updatediskgraphnew ("hdf","day");
+  updatediskgraphnew ("hdf","week");
+  updatediskgraphnew ("hdf","month");
+  updatediskgraphnew ("hdf","year");
+} else {
+  if (-e "$graphs/disk-hdf-day.png") {
+     system("rm $graphs/disk-hdf-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdg") {
+  close STAT; 
+  updatediskdatanew ("hdg");
+  updatediskgraphnew ("hdg","day");
+  updatediskgraphnew ("hdg","week");
+  updatediskgraphnew ("hdg","month");
+  updatediskgraphnew ("hdg","year");
+} else {
+  if (-e "$graphs/disk-hdg-day.png") {
+     system("rm $graphs/disk-hdg-day.png");
+  }
+}
+
+if (open STAT,"/dev/hdh") {
+  close STAT; 
+  updatediskdatanew ("hdh");
+  updatediskgraphnew ("hdh","day");
+  updatediskgraphnew ("hdh","week");
+  updatediskgraphnew ("hdh","month");
+  updatediskgraphnew ("hdh","year");
+} else {
+  if (-e "$graphs/disk-hdh-day.png") {
+     system("rm $graphs/disk-hdh-day.png");
+  }
+}
+
 ###
 ### Firewallhits
 ###