Solved

automatic restart

Posted on 1997-04-19
6
246 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 1

Accepted Solution

by:
hcheng earned 100 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
centos commands 6 93
Run Secure WMI query from CentOS 5 147
RPM creation 6 23
Nee dhelp identifying the OS and how to access 7 43
This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

726 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