From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1On7lJ-00051h-GQ for garchives@archives.gentoo.org; Sun, 22 Aug 2010 10:26:49 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6E33DE086C; Sun, 22 Aug 2010 10:26:29 +0000 (UTC) Received: from mx.virtyou.com (mx.virtyou.com [94.23.166.77]) by pigeon.gentoo.org (Postfix) with ESMTP id 25515E086C for ; Sun, 22 Aug 2010 10:26:29 +0000 (UTC) Received: from weird.localnet (p4FF041DA.dip.t-dialin.net [79.240.65.218]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx.virtyou.com (Postfix) with ESMTPSA id A1D2139A001 for ; Sun, 22 Aug 2010 12:26:28 +0200 (CEST) From: Alex Schuster To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Disable fcron logging Date: Sun, 22 Aug 2010 12:26:27 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.34-tuxonice-r1; KDE/4.5.0; x86_64; ; ) References: <201008211525.35115.wonko@wonkology.org> <68A64BAB-F743-4908-A608-7D5549B0444C@stellar.eclipse.co.uk> In-Reply-To: <68A64BAB-F743-4908-A608-7D5549B0444C@stellar.eclipse.co.uk> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 X-Length: 4563 X-UID: 159 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201008221226.28193.wonko@wonkology.org> X-Archives-Salt: 7fbeb2a8-4a6c-45e7-9f41-5a17ce678932 X-Archives-Hash: b8326bc292109688bf4f4d1124bfce17 Stroller writes: > On 21 Aug 2010, at 14:25, Alex Schuster wrote: > > ... > > I want to monitor the power status of my hard drives, so I wrote a > > little > > script that gives me this output: > >=20 > > sda: standby > > sdb: standby > > sdc: active/idle 32=B0C > > sdd: active/idle 37=B0C > >=20 > > This script is called every minute via an fcron entry, output goes > > into a log file, and I use the file monitor plasmoid to watch this log > > file in KDE. > >=20 > > It's working fine, but also monitor my syslog in another file > > monitor plamoid, and now I get lots of these entries: > >=20 > > Aug 21 14:21:06 [fcron] pam_unix(fcron:session): session opened for > > user root by (uid=3D0) > > Aug 21 14:21:06 [fcron] Job /usr/local/sbin/hdstate >> /var/log/ > > hdstate started for user root (pid 24483) > > Aug 21 14:21:08 [fcron] Job /usr/local/sbin/hdstate >> /var/log/ > > hdstate completed > > Aug 21 14:21:08 [fcron] pam_unix(fcron:session): session closed for > > user root >=20 > #!/bin/bash > while true > do > for drive in a b c d > do > /usr/sbin/smartctl /dev/sd$drive --whatever >> /var/log/hdstate > done > sleep 60 > done I use hdparm and hddtemp: for hd in sda sdb sdc sdd do str=3D$( /sbin/hdparm -C /dev/$hd ) state=3D${str##*is: } if [[ $state =3D=3D active/idle ]] && [[ $hd =3D~ sd[c] ]] then temp=3D$( /usr/sbin/hddtemp -q /dev/$hd ) temp=3D${temp% or *} temp=3D${temp##* } else temp=3D fi echo "$hd: $state $temp" done Unfortunately, reading the temperature makes a drive in standby spin up,=20 and prevents automatic spindown after a while of idle time. So now I ask=20 for the temperature only on my system drive, the others should sleep most=20 of the time anyway. > I would personally update more often than this, and my concern would > be that if the process fails then your plasmoid isn't showing the > correct data. >=20 > I presume this is the same with your current setup: if cron dies then > the current temperature will not be read to file, and the plasmoid > will continue reading the last lines in /var/log/hdstate - the drive > can overheat without you knowing about it. Nah, it's really not that important for me. I show the temperature just=20 for the fun of it, and for extreme temperatures I have smartd running, see= =20 below. I'm more interested in the active/standby state. I just added two old=20 additonal IDE drives for additional backups, and I want them to be silent=20 most of the time. So I wrote a little script to show the status so I see=20 when they spin up again (and they do this sometimes), and used fcron to=20 get the data into a log file that the plasmoids shows. The problem with cron is that I get those cron logs I do not like, and=20 that the update time of 60 seconds is a little long. Running the script in= =20 a loop, started in .kde4/Autostart, would be better, but as a user I have=20 no permission to call hdparm or hdtemp. I do not want to be part of the=20 disk group, and when using sudo I would get the logs by sudo I wanted to=20 avoid. So now I SUID'ed hdparm and hddtemp, changed the group to wheel and= =20 disabled execution for others. cron problem not solved, but workarounded. > So I would expect there to be a better "plasmid" for this task. I'm > completely unfamiliar with plasmids, but what you really want is a > plasmid that itself runs a script and displays the stdout on your > screen. That way if there's no data, or an error, then _you see that > in the plasmid_, instead of silently ignoring it (as you may be at > present). >=20 > The easiest (but dumb) way to handle this is to add the date to your > plasmid's display so that at least you can see that something's wrong > if it doesn't match the clock. A better way is not to have to watch a > status monitor at all, and just have a script running that emails you > if the temperature is above a specified range. I have smartd running, which should send me mails about such things. For=20 each drive, I have a line like this in /etc/smartd.conf: /dev/sdc -a -n standby -o on -S on -W 5,40,45 \ -s (S/../.././12|L/../../06/06) -m root@wonkology.org This does some regular health checks on the drive, when it is not in=20 standby mode. Temperature changes of more than 5 degrees and temperatures=20 of 40 degrees or more are logged. I will receive an email when the=20 temperature reaches 45 degrees, or when it reaches a new maximum. The=20 maximum values are preserved across boot cycles (option -S). Every day at=20 12:00, a short self test is scheduled, and a long self test each sunday on= =20 06:00. Wonko