Link to home
Start Free TrialLog in
Avatar of ManoaHI
ManoaHIFlag for United States of America

asked on

kill script if fsck or e2fsck is waiting on input

Operating System: Oracle Enterprise Release 5 Update 1 (RH code base - would be the same as Red Hat release)
Hardware: Sun Microsystems x4100 M2

I am coding a backup server system. Before mounting SAN filesystems, I need to fsck or e2fsck the file systems prior to mounting. If the check fails, it is easy enough to display a message, clean up and remove related processes. The problem that I am thinking about, have not yet encountered via bash script is, if fsck or e2fsck is waiting on user input particularly for whether or not you wish to use alternate superblock. My guess is that it would sit there forever, waiting for an answer. I want to answer no and die. I can't see anything that would say to call that an error and die. I would like to know if there is a way to wait 2 seconds or so waiting on input to just do same tasks as if the check had failed? if trap, what would i trap for. If there some other way to answer no, display a message and die? Is there some undocumented flag or alternate fsck utility that would just error if it got to that point?

Thank you,
Mark N.

ASKER CERTIFIED SOLUTION
Avatar of ravenpl
ravenpl
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ManoaHI

ASKER

Thanks, I'll put the -p option and take out the -y in so that it works with Solaris as well as Linux. By any chance does anyone know how to force a disk to ask to use the alternate superblock (essentially corrupt it on purpose) to see if that works?