Gentoo Archives: gentoo-user

From: Stroller <stroller@××××××××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Disable fcron logging
Date: Sat, 21 Aug 2010 20:04:34
Message-Id: 68A64BAB-F743-4908-A608-7D5549B0444C@stellar.eclipse.co.uk
In Reply to: [gentoo-user] Disable fcron logging by Alex Schuster
1 On 21 Aug 2010, at 14:25, Alex Schuster wrote:
2 > ...
3 > I want to monitor the power status of my hard drives, so I wrote a
4 > little
5 > script that gives me this output:
6 >
7 > sda: standby
8 > sdb: standby
9 > sdc: active/idle 32°C
10 > sdd: active/idle 37°C
11 >
12 > This script is called every minute via an fcron entry, output goes
13 > into a
14 > log file, and I use the file monitor plasmoid to watch this log file
15 > in
16 > KDE.
17 >
18 > It's working fine, but also monitor my syslog in another file monitor
19 > plamoid, and now I get lots of these entries:
20 >
21 > Aug 21 14:21:06 [fcron] pam_unix(fcron:session): session opened for
22 > user root by (uid=0)
23 > Aug 21 14:21:06 [fcron] Job /usr/local/sbin/hdstate >> /var/log/
24 > hdstate started for user root (pid 24483)
25 > Aug 21 14:21:08 [fcron] Job /usr/local/sbin/hdstate >> /var/log/
26 > hdstate completed
27 > Aug 21 14:21:08 [fcron] pam_unix(fcron:session): session closed for
28 > user root
29
30
31 #!/bin/bash
32 while true
33 do
34 for drive in a b c d
35 do
36 /usr/sbin/smartctl /dev/sd$drive --whatever >> /var/log/hdstate
37 done
38 sleep 60
39 done
40
41
42 I would personally update more often than this, and my concern would
43 be that if the process fails then your plasmoid isn't showing the
44 correct data.
45
46 I presume this is the same with your current setup: if cron dies then
47 the current temperature will not be read to file, and the plasmoid
48 will continue reading the last lines in /var/log/hdstate - the drive
49 can overheat without you knowing about it.
50
51 So I would expect there to be a better "plasmid" for this task. I'm
52 completely unfamiliar with plasmids, but what you really want is a
53 plasmid that itself runs a script and displays the stdout on your
54 screen. That way if there's no data, or an error, then _you see that
55 in the plasmid_, instead of silently ignoring it (as you may be at
56 present).
57
58 The easiest (but dumb) way to handle this is to add the date to your
59 plasmid's display so that at least you can see that something's wrong
60 if it doesn't match the clock. A better way is not to have to watch a
61 status monitor at all, and just have a script running that emails you
62 if the temperature is above a specified range.
63
64 Stroller.

Replies

Subject Author
Re: [gentoo-user] Disable fcron logging Alex Schuster <wonko@×××××××××.org>