Advertisement

11.17.2008 at 04:14PM PST, ID: 23912811 | Points: 125
[x]
Attachment Details

kill script  if fsck or e2fsck is waiting on input

Tags:

bash script

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.

Top Expert: Tintin
Expert Since: 11/13/2002
Accepted Solutions: 3706
Tintin has been an Expert for 6 years1 month, during which he has posted 13256 comments and answered 3706 questions. Tintin is just one of 190 experts in the Bourne-Again Shell (bash) Zone.
 
 
20081119-EE-VQP-48 - Hierarchy / EE_QW_2_20070628