forced fsck (again?)

Bryan Kadzban bryan at kadzban.is-a-geek.net
Wed Jan 23 01:50:33 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Theodore Tso wrote:
> So ---- for someone who has time, I offer the following challenge.
> Take the above script, and enhance it in the following ways:
> 
> 	* Read a configuration file to see which filesystem(s) to
>           check and to which e-mail the error reports should be sent.

Add support for checking multiple FSes, too.  :-)

> 	* Have the script abort the check if the system appears to be
>           running off of a battery.

Sort of.  Much of this on_ac_power function was stolen from Debian's
powermgmt_base package's on_ac_power script, but it doesn't support
anything other than ACPI.  (It checks the new sysfs power_supply class
first, and the /proc/acpi/ac_adapter/ directory second.)

If the function can't determine if AC power is available, the script
assumes it's on battery, and exits; this is suboptimal for desktops, but
good for laptops that don't have ACPI turned on for whatever reason.

> 	* Have the config file define a time period (say, 30 days),
>           and have the script test to see if the last_mount time is
>           greater than the time interval.  If it is, then it does the
>           check, otherwise it skips it.

Well, this script looks at the last-check time, not the last-mount time.
But close enough.

> With these enhancements, in the laptop case the script could be fired
> off by cron every night at 3am, and if a month has gone by without a
> check, AND the laptop is running off the AC mains, the check happens
> automatically, in the background.

See the attached script (e2check) and sample config file (e2check.conf).
:-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHlp1nS5vET1Wea5wRA2XkAKC9vPadZzYxbBITFVkSUAntYGOk4QCg4+SZ
QK+2xfdB7wtVF/J152S/P2s=
=lhcS
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: e2check
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20080122/e1beb85d/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: e2check.conf
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20080122/e1beb85d/attachment.conf>


More information about the Ext3-users mailing list