mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-06 13:06:11 +02:00
hddshutdown mit sonderbehandlung für SATA
makegraphs um -d ata ergaenzt MPFire Paket angepasst git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@904 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -63,6 +63,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
|||||||
install -v -m 755 $(DIR_SRC)/config/mpfire/mpfire.pl /var/ipfire/mpfire/bin
|
install -v -m 755 $(DIR_SRC)/config/mpfire/mpfire.pl /var/ipfire/mpfire/bin
|
||||||
install -v -m 644 $(DIR_SRC)/config/mpfire/mpd.conf /var/ipfire/mpfire/
|
install -v -m 644 $(DIR_SRC)/config/mpfire/mpd.conf /var/ipfire/mpfire/
|
||||||
install -v -m 644 $(DIR_SRC)/config/mpfire/webradio /var/ipfire/mpfire/
|
install -v -m 644 $(DIR_SRC)/config/mpfire/webradio /var/ipfire/mpfire/
|
||||||
chown root.nobody /var/ipfire/mpfire/{settings,playlist.m3u,webradio,mpd.conf}
|
chown root.nobody /var/ipfire/mpfire/{mpd.conf,playlist.m3u}
|
||||||
chown root.nobody /var/ipfire/mpfire/db/mpd.db
|
chown nobody.nobody /var/ipfire/mpfire/{settings,webradio}
|
||||||
|
chown root.nobody /var/ipfire/mpfire/db/mpd.db
|
||||||
@$(POSTBUILD)
|
@$(POSTBUILD)
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ int main(void)
|
|||||||
else
|
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 -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 -e 's#\\.\\*/var/log/messages\\.\\*#%s /var/log/messages#' /etc/syslog.conf >&%d", varmessages, config_fd );
|
||||||
|
|
||||||
/* if the return code isn't 0 failsafe */
|
/* if the return code isn't 0 failsafe */
|
||||||
if ((rc = unpriv_system(buffer,99,99)) != 0)
|
if ((rc = unpriv_system(buffer,99,99)) != 0)
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
. /opt/pakfire/lib/functions.sh
|
. /opt/pakfire/lib/functions.sh
|
||||||
|
|
||||||
extract_files
|
extract_files
|
||||||
ln -svf ../init.d/mpd /etc/rc.d/rc3.d/S65mpd
|
ln -svf /etc/init.d/mpd /etc/rc.d/rc3.d/S65mpd
|
||||||
ln -svf ../init.d/mpd /etc/rc.d/rc0.d/K35mpd
|
ln -svf /etc/init.d/mpd /etc/rc.d/rc0.d/K35mpd
|
||||||
ln -svf ../init.d/mpd /etc/rc.d/rc6.d/K35mpd
|
ln -svf /etc/init.d/mpd /etc/rc.d/rc6.d/K35mpd
|
||||||
|
ln -svf /etc/init.d/mpd /etc/rc.d/rc6.d/K35mpd
|
||||||
|
ln -svf /var/ipfire/mpfire/mpd.conf /etc/mpd.conf
|
||||||
touch /var/log/mpd.error.log
|
touch /var/log/mpd.error.log
|
||||||
touch /var/log/mpd.log
|
touch /var/log/mpd.log
|
||||||
|
|||||||
@@ -20,23 +20,31 @@ if ($debug){print "### Searching for available Disks ###\n";}
|
|||||||
foreach (@devices){
|
foreach (@devices){
|
||||||
chomp $_;
|
chomp $_;
|
||||||
$diskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
$diskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
||||||
$status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;
|
|
||||||
|
if ( $_ =~ /^s/ ){$status = `sdparm --command=ready /dev/$_ | tail -1`;}
|
||||||
|
else {$status = `hdparm -C /dev/$_ | tail -1 | cut -d: -f2`;}
|
||||||
|
|
||||||
chomp $status;
|
chomp $status;
|
||||||
chomp $diskstats;
|
chomp $diskstats;
|
||||||
if ($debug){print "Device ".$_." is in status".$status." and has ".$diskstats." write and read Requests.\n";}
|
if ($debug){print "Device ".$_." is in status ".$status." and has ".$diskstats." write and read Requests.\n";}
|
||||||
sleep 30;
|
sleep 30;
|
||||||
|
|
||||||
$newdiskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
$newdiskstats = `iostat -d -t $_ | tail -2 | head -1 | awk '{ print \$5","\$6}'`;
|
||||||
chomp $newdiskstats;
|
chomp $newdiskstats;
|
||||||
|
|
||||||
if ($diskstats eq $newdiskstats && $status !=~/standby/){
|
if ($diskstats eq $newdiskstats && $status !~/standby/){
|
||||||
if ($debug){print "Device ".$_." is set to standy.\n";}
|
if ($debug){print "Device ".$_." is set to standy.\n";}
|
||||||
system("/sbin/hdparm -y /dev/$_");
|
if ( $_ =~ /^s/ ){system("sdparm --command=stop /dev/$_");}
|
||||||
|
else {system("/sbin/hdparm -y /dev/$_");}
|
||||||
system("touch /tmp/hddshutdown-$_");
|
system("touch /tmp/hddshutdown-$_");
|
||||||
}
|
}
|
||||||
else{
|
elsif ($diskstatus{$_} ne "0" ){
|
||||||
if ($debug){print "Device ".$_." is active.\n";}
|
if ($debug){print "Device ".$_." is active.\n";}
|
||||||
if ( -e "/tmp/hddshutdown-$_" ) { system("unlink /tmp/hddshutdown-$_"); }
|
if ( -e "/tmp/hddshutdown-$_" ) { system("unlink /tmp/hddshutdown-$_"); }
|
||||||
}
|
}
|
||||||
|
elsif ( $status =~/standby/ ){
|
||||||
|
if ($debug){print "Device ".$_." is in standby mode.\n";}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# end
|
# end
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ sub updatehdddata
|
|||||||
|
|
||||||
if ( -e "$path_smartctl" )
|
if ( -e "$path_smartctl" )
|
||||||
{
|
{
|
||||||
system("$path_smartctl -iHA /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
|
system("$path_smartctl -iHA -d ata /dev/$disk > /var/log/smartctl_out_hddtemp-$disk");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( -e "$path_hddtemp" )
|
if ( -e "$path_hddtemp" )
|
||||||
|
|||||||
Reference in New Issue
Block a user