+------------------------------------------------------------------------
+r790 | ms | 2007-08-20 18:25:59 +0400 (Mon, 20 Aug 2007) | 2 lines
+
+Netzwerkscripts: DHCP vollstaendig getestet und gefixt.
+
+------------------------------------------------------------------------
+r789 | ms | 2007-08-20 17:21:16 +0400 (Mon, 20 Aug 2007) | 3 lines
+
+Setup weiter ausgebaut.
+Initrd des Installationssystems verkleinert.
+
+------------------------------------------------------------------------
+r788 | ms | 2007-08-20 13:01:12 +0400 (Mon, 20 Aug 2007) | 2 lines
+
+Setup SegFault-Fix.
+
+------------------------------------------------------------------------
+r787 | ms | 2007-08-20 01:55:19 +0400 (Mon, 20 Aug 2007) | 3 lines
+
+dhcpcd.exe geschrieben.
+asterisk.cgis geloescht.
+
+------------------------------------------------------------------------
+r786 | ms | 2007-08-20 01:39:43 +0400 (Mon, 20 Aug 2007) | 2 lines
+
+Fuse bereinigt.
+
+------------------------------------------------------------------------
+r785 | ms | 2007-08-20 01:21:25 +0400 (Mon, 20 Aug 2007) | 4 lines
+
+Rudimentaere ISDN-Erkennung erstellt.
+ProbeHW optimiert weges des via-rhine-Problem.
+Grubs gfx-Menue entfernt wegen der Kompatibilitaet.
+
+------------------------------------------------------------------------
+r784 | maniacikarus | 2007-08-20 00:18:59 +0400 (Mon, 20 Aug 2007) | 2 lines
+
+Fix am Installer
+
+------------------------------------------------------------------------
+r783 | maniacikarus | 2007-08-19 23:59:53 +0400 (Sun, 19 Aug 2007) | 2 lines
+
+Nochmal kleine Korrekturen an den Sprachdateien und der Remote CGI
+
+------------------------------------------------------------------------
+r782 | maniacikarus | 2007-08-19 23:35:46 +0400 (Sun, 19 Aug 2007) | 2 lines
+
+Translations fuer den Installer gemacht
+
+------------------------------------------------------------------------
+r781 | maniacikarus | 2007-08-19 11:21:46 +0400 (Sun, 19 Aug 2007) | 2 lines
+
+Buildfix
+
------------------------------------------------------------------------
r780 | maniacikarus | 2007-08-18 23:10:10 +0400 (Sat, 18 Aug 2007) | 4 lines
#!/usr/bin/perl
#
-# IPFire HDD Shutdown
+# IPFire HDD Shutdown state reader
#
# This code is distributed under the terms of the GPL
#
-# 13.05.2006 Arne Fitzenreiter
+# 20.08.2007 Maniacikarus - IPFire.org - maniacikarus@ipfire.org
#
# begin
-sub shutdown_hdd {
+my @proc = `cat /proc/diskstats`;
+my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
+my %diskstatus = "";
+my $debug = 1;
+my $status = "unknown";
- my $hdd = $_[0];
- my $hdddev = "/dev/$_[0]";
+if ( @ARGV[0] eq "state" ){
+my $hdd = @ARGV[1];
+$status = `hdparm -C /dev/$hdd | tail -1 | cut -d: -f2`;
- 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;
+if ( $status=~/standby/){
+ my $ftime = localtime((stat("/tmp/hddshutdown-$hdd"))[9]);
+ print"<B>Disk $hdddev status: <font color=#00FF00>standby</font></B> (since $ftime)";
+ }
+else{
+ print"<B>Disk $hdddev status: <font color=#FF0000>active</font></B>";
+ }
+exit;
+}
- 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];
- }
- }
- }
- }
+if ($debug){print "### Reading Diskstats ###\n";}
- 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];
- }
- }
- }
- }
+foreach (@proc){
+my @line = split(/ +/,$_);
+$diskstatus{$line[3]} =$line[12];
+if ($debug){print "Getting device ".$line[3]." with the following value ".$line[12]."\n";}
+}
- if (! -e "/tmp/hddshutdown-$hdd" ) { system("echo 0 > /tmp/hddshutdown-$hdd"); }
+if ($debug){print "### Searching for available Disks ###\n";}
- if ($readwritereq==$lastreadwritereq) {
- open STAT,"/tmp/hddshutdown-$hdd";
- my $lastsleepstate = <STAT>;
- close (STAT);
- if (! ($lastsleepstate==$readwritereq)) {
- system("hdparm -y $hdddev");
- system("logger -t ipfire Shuting down $hdddev !");
- system("echo $readwritereq > /tmp/hddshutdown-$hdd");
- }
- }
-
-}
+foreach (@devices){
+chomp $_;
+if ($debug){print "Device ".$_." has ".$diskstatus{$_}." IO Requests.\n";}
+$status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;
-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 ($diskstatus{$_} eq "0" && $status !=~/standby/){
+ if ($debug){print "Device ".$_." is set to standy.\n";}
+ system("/sbin/hdparm -y /dev/$_");
+ system("touch /tmp/hddshutdown-$_");
}
- if (open STAT,"/dev/hdc") {
- close STAT;
- shutdown_hdd("hdc");
+ elsif ($diskstatus{$_} ne "0" || $status !=~/standby/){
+ if ($debug){print "Device ".$_." is active.\n";}
+ if ( -e "/tmp/hddshutdown-$_" ) { system("unlink /tmp/hddshutdown-$_"); }
}
- 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
+++ /dev/null
-#!/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