[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

automatic restart

Hi

I am running 3 terminal servers on linux (1 has 4, 1 has 8, and 1 has 16
serial ports). The servers are accessed through a Telnet connection and
do not have their own screens. The problem is that if power goes down
and the system is not shutdown properly we end up restoring the file
system manually by running
        e2fsck -b 8193 /dev/hda3
and the rebooting.
i was wondering if there is any way to make the system run this command
by itself if it detects a corrupted file system and not to require any
user prompt?

the only other solution i see is a UPS....

seva batkin
nortel
0
ruski
Asked:
ruski
  • 3
  • 2
1 Solution
 
hchengCommented:
You can write a shell script that upon startup, run e2fsck (or fsck if you want) on the disk without any special repair parameters.  Then, you can check the exit codes (taken from e2fsck's man page):

       The exit code returned by e2fsck is the sum of the follow-
       ing conditions:
            0    - No errors
            1    - File system errors corrected
            2    - File system errors corrected, system should
                   be rebooted if file system was mounted
            4    - File system errors left uncorrected
            8    - Operational error
            16   - Usage or syntax error
            128  - Shared library error

If you see the appropriate exit code, you can run your manual e2fsck command followed by a "shutdown" (after checking the exit code of your manual e2fsck command).

I think UPS is probably the best option if you can afford one.
0
 
ruskiAuthor Commented:
it doesn't tell me anything new. I still have to check the error codes manually and then run the program by hand.
0
 
virgo21Commented:
Then you should give him an F.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
hchengCommented:
Why would you have to check the error codes manually?  You can check it in your start up script like this:

  /sbin/e2fsck
  if [ $? -gt 0 ]; then
    echo "error detected."
    /sbin/e2fsck -b 8193 /dev/hda3
    if [$? -eq 0]; then
      echo "fixed."
      /sbin -r now
    else
      echo "fix it yourself."
      /usr/bin/login
    fi
  fi

Does this segment do what you want, or am I not understanding what you are asking for?
0
 
ruskiAuthor Commented:
you see the answer is good, but you still have the "repair it yourself" prompt. I need something that would not require that. TO be done comletely automatically. If there are corrupted files - it fixes them, if there are bad links it fixes them as well.
0
 
hchengCommented:
Oh.  I thought that the e2fsck -b 8193 line you gave will always fix whatever problems that you have.  I guess the e2fsck command may also prompts you for input.  If you want to say "yes" to all the questions, you can use the "-y" switch.  Is that what you want?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now