?
Solved

automatic restart

Posted on 1997-04-19
6
Medium Priority
?
249 Views
Last Modified: 2013-12-15
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
Comment
Question by:ruski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:hcheng
ID: 1627190
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
 

Author Comment

by:ruski
ID: 1627191
it doesn't tell me anything new. I still have to check the error codes manually and then run the program by hand.
0
 

Expert Comment

by:virgo21
ID: 1627192
Then you should give him an F.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 1

Accepted Solution

by:
hcheng earned 200 total points
ID: 1627193
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
 

Author Comment

by:ruski
ID: 1627194
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
 
LVL 1

Expert Comment

by:hcheng
ID: 1627195
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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question