LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   checking filesystem (https://www.linuxquestions.org/questions/linux-software-2/checking-filesystem-4175512496/)

ganesan_p 07-28-2014 07:07 AM

checking filesystem
 
hi i know the chkfsys utility and know how to check through command line . but i want to check in script .

i have cf having 4 partition . 1st partition having qnx image . after booting i have to check filesystem on other partition . if any error having those partition i have to display the error and shutdown . i don't how to do it. please help me to check filesystem in scipting and take decission .

questions:
1) if error on any partition ,chkfsys utility returns anythink?
2) how to take decissions if errors occur?
3) how i kow this partition is error?.

note:i have partition type- hd0t77,hd0t78,hd0t79,hd0t80

i checked below script but this is also not working . "status:not found" error is comming ,

#!/bin/sh
######
# My Test Script
######

echo Test Chkfsys Output

chkfsys -u /dev/hd0t77 $1
STATUS=$?
if test STATUS -ne 0
then
echo "An error occured while running chkfsys!"
else
echo"error not occured"

fi

# end of Test Script

please help me,

thanks and regards,
ganesan

pan64 07-28-2014 08:01 AM

see man page, or here: http://www.qnx.com/developers/docs/q...g_chkfsys.html
chkfsys will return nonzero in case of problems.

you need to use $ in your test command:
if test $STATUS -ne 0

TB0ne 07-29-2014 09:12 AM

Quote:

Originally Posted by ganesan_p (Post 5210722)
hi i know the chkfsys utility and know how to check through command line . but i want to check in script .
i have cf having 4 partition . 1st partition having qnx image . after booting i have to check filesystem on other partition . if any error having those partition i have to display the error and shutdown . i don't how to do it. please help me to check filesystem in scipting and take decission .

questions:
1) if error on any partition ,chkfsys utility returns anythink?

If you know how to use the chkfsys utility, then you should know what it returns...especially since the man page TELLS YOU.
Quote:

2) how to take decissions if errors occur?
This is your script...YOU made the decisions however you'd like. Check the return code, and act on whatever you find.
Quote:

3) how i kow this partition is error?.
You know by CHECKING THE OUTPUT of the command you ran
Quote:

note:i have partition type- hd0t77,hd0t78,hd0t79,hd0t80

i checked below script but this is also not working . "status:not found" error is comming ,
Code:

#!/bin/sh
echo Test Chkfsys Output

chkfsys -u /dev/hd0t77 $1
STATUS=$?
if test STATUS -ne 0
then
    echo "An error occured while running chkfsys!"
else
    echo"error not occured"
 
fi

# end of Test Script


...which is VERY similar to your other thread:
http://www.linuxquestions.org/questi...em-4175511911/

You're getting "not found", because you just put "chkfsys" in your script, probably. Try putting the whole path into the script...and again, reading the bash scripting tutorials wouldn't be a bad idea.

ganesan_p 07-30-2014 05:31 AM

hi ,
i have one question,

can mount the corrupted filesystem partition?


regards,
ganesan

TB0ne 07-30-2014 08:34 AM

Quote:

Originally Posted by ganesan_p (Post 5211837)
hi ,
i have one question,

can mount the corrupted filesystem partition?

Since it's CORRUPTED, obviously not. Please see any of your other numerous threads about partitions for more hints to help you get going.


All times are GMT -5. The time now is 06:10 PM.