]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Neuer Versuch fuer Syslog
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 18 Sep 2007 17:33:42 +0000 (17:33 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 18 Sep 2007 17:33:42 +0000 (17:33 +0000)
Index Refresh bei Shutdown und Reboot angepasst
hddshutdown umgeschrieben

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

html/cgi-bin/index.cgi
src/misc-progs/syslogdctrl.c
src/scripts/hddshutdown

index 28bd09c88b4b49833a1bccf166641bd1c3edff86..f227a1703e62c50f6cdd5654cce4223306f8e827 100644 (file)
@@ -55,10 +55,13 @@ my %mainsettings = ();
 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
 
 my $connstate = &Header::connectionstatus();
-if ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
-       $refresh = "<meta http-equiv='refresh' content='30;'>";
+
+if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'} || $cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
+       $refresh = "<meta http-equiv='refresh' content='300;'>";
 } elsif ($connstate =~ /$Lang::tr{'connecting'}/) {
        $refresh = "<meta http-equiv='refresh' content='5;'>";
+} elsif ($connstate =~ /$Lang::tr{'dod waiting'}/ || -e "${General::swroot}/main/refreshindex") {
+       $refresh = "<meta http-equiv='refresh' content='30;'>";
 }
 
 if ($cgiparams{'ACTION'} eq $Lang::tr{'dial profile'})
index db2659ecb42ddee0d1f88bb5d75070bf756b98f2..184f450145be349ead03015d2f370d6a6eba08ca 100644 (file)
@@ -112,7 +112,7 @@ int main(void)
    else
       snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd );
       
-      snprintf(buffer, STRING_SIZE - 1, "/bin/sed 's/.*\\/var\\/log\\/messages.*/%s     \\/var\\/log\\/messages/' /etc/syslog.conf >&%d", varmessages, config_fd );
+      snprintf(buffer, STRING_SIZE - 1, "/bin/sed 's#.*/var/log/messages.*#%s     /var/log/messages#' /etc/syslog.conf >&%d", varmessages, config_fd );
 
    /* if the return code isn't 0 failsafe */
    if ((rc = unpriv_system(buffer,99,99)) != 0)
index 6bd24104f0bb91a9753072469d32062871b73b9c..86ec23d48082df5935a294211c8bcf7529d9354a 100644 (file)
@@ -4,37 +4,34 @@
 #
 # This code is distributed under the terms of the GPL
 #
-# 20.08.2007 Maniacikarus - IPFire.org - maniacikarus@ipfire.org
+# 18.09.2007 Maniacikarus - IPFire.org - maniacikarus@ipfire.org
 #
 
 # begin
 
-my @proc = `cat /proc/diskstats`;
 my @devices = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`;
-my %diskstatus = "";
-my %diskstate = "";
+my $diskstats = "";
+my $newdiskstats = "";
 my $debug = 1;
 my $status = "unknown";
 
-if ($debug){print "### Reading Diskstats ###\n";}
-
-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 ($debug){print "### Searching for available Disks ###\n";}
 
 foreach (@devices){
 chomp $_;
-if ($debug){print "Device ".$_." has ".$diskstatus{$_}." IO Requests.\n";}
+$diskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
 $status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;
-
-  if ($diskstatus{$_} eq "0" && $status !=~/standby/){
-    if ($debug){print "Device ".$_." is set to standy.\n";}
-    system("/sbin/hdparm -y /dev/$_");
-    system("touch /tmp/hddshutdown-$_");
+chomp $status;
+chomp $diskstats;
+if ($debug){print "Device ".$_." is in status".$status." and has ".$diskstats." write and read Requests.\n";}
+sleep 30;
+$newdiskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
+chomp $newdiskstats;
+
+  if ($diskstats eq $newdiskstats && $status !=~/standby/){
+      if ($debug){print "Device ".$_." is set to standy.\n";}
+      system("/sbin/hdparm -y /dev/$_");
+      system("touch /tmp/hddshutdown-$_");
   }
   elsif ($diskstatus{$_} ne "0" || $status !=~/standby/){
     if ($debug){print "Device ".$_." is active.\n";}