From: Arne Fitzenreiter Date: Wed, 8 Oct 2008 21:19:01 +0000 (+0200) Subject: Move hddshutdown status from /tmp to /var/run X-Git-Tag: v2.3-beta5~7^2 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=965f45472de3b6871347a682a393336ef839eaa2 Move hddshutdown status from /tmp to /var/run tmp is now again on harddisk --- diff --git a/config/etc/fstab b/config/etc/fstab index 2b8682d00f..867a991ae8 100644 --- a/config/etc/fstab +++ b/config/etc/fstab @@ -8,7 +8,7 @@ DEVICE4 /var FSTYPE defaults 1 1 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 -none /tmp tmpfs defaults 0 0 +#none /tmp tmpfs defaults 0 0 none /var/log/rrd tmpfs defaults,size=64M 0 0 none /var/lock tmpfs defaults,size=16M 0 0 none /var/run tmpfs defaults,size=16M 0 0 diff --git a/config/rootfiles/updater/filelists/files b/config/rootfiles/updater/filelists/files index 2d9f65a4fe..4ef61a0385 100644 --- a/config/rootfiles/updater/filelists/files +++ b/config/rootfiles/updater/filelists/files @@ -23,6 +23,7 @@ etc/udev/rules.d/55-scsi-cdrom.rules etc/linuxigd/gatedesc.xml usr/local/bin/getiptstate usr/local/bin/makegraphs +usr/local/bin/hddshutdown usr/local/bin/squidctrl usr/local/bin/setddns.pl srv/web/ipfire/cgi-bin/backup.cgi diff --git a/config/rootfiles/updater/update.sh b/config/rootfiles/updater/update.sh index 3b2bbe5962..678a6e8777 100755 --- a/config/rootfiles/updater/update.sh +++ b/config/rootfiles/updater/update.sh @@ -161,7 +161,7 @@ grub-install --no-floppy ${ROOT::`expr length $ROOT`-1} # Update fstab # grep -v "tmpfs" /etc/fstab > /tmp/fstab.tmp -echo "none /tmp tmpfs defaults 0 0" >> /tmp/fstab.tmp +echo "#none /tmp tmpfs defaults 0 0" >> /tmp/fstab.tmp echo "none /var/log/rrd tmpfs defaults,size=64M 0 0" >> /tmp/fstab.tmp echo "none /var/lock tmpfs defaults,size=16M 0 0" >> /tmp/fstab.tmp echo "none /var/run tmpfs defaults,size=16M 0 0" >> /tmp/fstab.tmp diff --git a/html/cgi-bin/media.cgi b/html/cgi-bin/media.cgi index 490ffcad94..4fe472a029 100644 --- a/html/cgi-bin/media.cgi +++ b/html/cgi-bin/media.cgi @@ -195,8 +195,8 @@ sub diskbox { my $disk = $_[0]; chomp $disk; my @status; - if (-e "/tmp/hddstatus"){ - open(DATEI, "; close(DATEI); @@ -205,7 +205,7 @@ sub diskbox { } if ( $status[1]=~/standby/){ - my $ftime = localtime((stat("/tmp/hddshutdown-$disk"))[9]); + my $ftime = localtime((stat("/var/run/hddshutdown-$disk"))[9]); print"Disk $disk status:".$status[1]." (since $ftime)"; }else{ print"Disk $disk status:".$status[1].""; diff --git a/src/scripts/hddshutdown b/src/scripts/hddshutdown index 056adf3754..28994998bd 100644 --- a/src/scripts/hddshutdown +++ b/src/scripts/hddshutdown @@ -20,7 +20,7 @@ if ($debug){print "### Searching for available Disks ###\n";} foreach (@devices){ chomp $_; my @array = split(/\//,$_); - $diskstats = `cat /tmp/hddstats-$array[$#array]`; + $diskstats = `cat /var/run/hddstats-$array[$#array]`; chomp $diskstats; $newdiskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`; chomp $newdiskstats; @@ -28,14 +28,14 @@ foreach (@devices){ chomp $status; if ($debug){print "Device ".$_." IDE Power status:".$status."\n";} - if (-e "/tmp/hddshutdown-$array[$#array]" && $status !~/standby/) + if (-e "/var/run/hddshutdown-$array[$#array]" && $status !~/standby/) { if ($debug){print "Remove wrong standby marking\n";} - if ( -e "/tmp/hddshutdown-$array[$#array]" ) { system("unlink /tmp/hddshutdown-$array[$#array]"); } + if ( -e "/var/run/hddshutdown-$array[$#array]" ) { system("unlink /var/run/hddshutdown-$array[$#array]"); } } if ($debug){print "Device ".$_." has ".$newdiskstats." write and read Requests, was ".$diskstats." at last run.\n";} - if ($diskstats eq $newdiskstats && (! -e "/tmp/hddshutdown-$array[$#array]") ) + if ($diskstats eq $newdiskstats && (! -e "/var/run/hddshutdown-$array[$#array]") ) { if ($debug){print "Setting Device ".$_." to standby ... ";} $status = `hdparm -y /dev/$_ 2>&1`; @@ -43,7 +43,7 @@ foreach (@devices){ if ($status !~/Invalid/) { if ($debug){print "OK\n";} - system("touch /tmp/hddshutdown-$array[$#array]"); + system("touch /var/run/hddshutdown-$array[$#array]"); } else { @@ -53,9 +53,9 @@ foreach (@devices){ if ($diskstats ne $newdiskstats) { if ($debug){print "Device ".$_." is active.\n";} - if ( -e "/tmp/hddshutdown-$array[$#array]" ) { system("unlink /tmp/hddshutdown-$array[$#array]"); } + if ( -e "/var/run/hddshutdown-$array[$#array]" ) { system("unlink /var/run/hddshutdown-$array[$#array]"); } } - system("echo $newdiskstats > /tmp/hddstats-$array[$#array]"); + system("echo $newdiskstats > /var/run/hddstats-$array[$#array]"); } # end diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs index 9542c8f485..817920ab73 100644 --- a/src/scripts/makegraphs +++ b/src/scripts/makegraphs @@ -60,7 +60,7 @@ sub updatehdddata{ print "Error in RRD::create for hddshutdown-".$array[$#array].": $ERROR\n" if $ERROR; } - if (-e "/tmp/hddshutdown-".$array[$#array]) {$standby = 1;} + if (-e "/var/run/hddshutdown-".$array[$#array]) {$standby = 1;} else {$standby = 0;} RRDs::update ("$mainsettings{'RRDLOG'}/hddshutdown-".$array[$#array].".rrd", "-t", "standby", "N:$standby"); @@ -83,9 +83,9 @@ sub updatehdddata{ if (!$standby){ $temp = 0; my $smart_output = ''; - system("$path_smartctl -iHA -d ata /dev/$disk > /tmp/smartctl_out_hddtemp-$disk"); - if ( -e "/tmp/smartctl_out_hddtemp-".$array[$#array] ){ - my $hdd_output = `cat /tmp/smartctl_out_hddtemp-$array[$#array] | grep Temperature_`; + system("$path_smartctl -iHA -d ata /dev/$disk > /var/run/smartctl_out_hddtemp-$disk"); + if ( -e "/var/run/smartctl_out_hddtemp-".$array[$#array] ){ + my $hdd_output = `cat /var/run/smartctl_out_hddtemp-$array[$#array] | grep Temperature_`; my @t = split(/\s+/,$hdd_output); $temp = $t[9]; }else{$temp = 0;} @@ -103,7 +103,7 @@ sub updatehdddata{ system ('/usr/bin/vnstat -u'); my @disks = `kudzu -qps -c HD | grep device: | cut -d" " -f2 | sort | uniq`; -system("unlink /tmp/hddstatus && touch /tmp/hddstatus"); +system("unlink /var/run/hddstatus && touch /var/run/hddstatus"); foreach (@disks){ my $disk = $_; chomp $disk; @@ -114,7 +114,7 @@ foreach (@disks){ my $newdiskstats = ""; my @array = split(/\//,$disk); - $diskstats = `cat /tmp/hddstats-$array[$#array]`; + $diskstats = `cat /var/run/hddstats-$array[$#array]`; chomp $diskstats; my $newdiskstats = `/usr/bin/iostat -d -t $disk | tail -2 | head -1 | awk '{ print \$5","\$6}'`; chomp $newdiskstats; @@ -122,13 +122,13 @@ foreach (@disks){ chomp $status; if ($status !~/standby/ || $diskstats ne $newdiskstats){ - if (-e "/tmp/hddshutdown-".$array[$#array]){system("unlink /tmp/hddshutdown-".$array[$#array]);} + if (-e "/var/run/hddshutdown-".$array[$#array]){system("unlink /var/run/hddshutdown-".$array[$#array]);} } - if (-e "/tmp/hddshutdown-".$array[$#array]){$status = " standby\n";} + if (-e "/var/run/hddshutdown-".$array[$#array]){$status = " standby\n";} else{$status = " active\n";} - open(DATEI, ">>/tmp/hddstatus") || die "Datei nicht gefunden"; + open(DATEI, ">>/var/run/hddstatus") || die "Datei nicht gefunden"; print DATEI $disk."-".$status; close(DATEI);