Filesystem_checking


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filesystem_checking
# 1  
Old 07-30-2014
Filesystem_checking

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 ran below script it is working but every time it is asking userinput ...
i don't want asking user input ...


Code:
#!/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 palanisamy

Moderator's Comments:
Mod Comment code tags please

Last edited by jim mcnamara; 07-30-2014 at 09:25 AM..
# 2  
Old 07-30-2014
What system has checkfsys? HP? I assume your usage is correct because you use it manually.

You have some syntax errors in your code -

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

echo Test Chkfsys Output
echo "parameter is $1"         # validate parm 1, remove later after testing
chkfsys -u /dev/hd0t77 $1   # I assume this run on command line works, $1 is correct value
STATUS=$?

if  [ $STATUS -ne 0 ]   # add $ , use [ which is test
then
 echo "An error occured while running chkfsys!"
 exit 1
else
 echo   "error not occured"  # added a space after echo

fi

# end of Test Script

# 3  
Old 07-30-2014
thanks for your reply jim,

i added your what u suggest.

but it is asking user input like yes/no questions..
Code:
Dir /dev/hd0t77/lib/dll
[ /dev/hd0t77/lib/ ]
bad xblock (0x14F88) signature: FIXABLE (data probably lost when fixed).
fix (Y/n) ?    N
[ /dev/hd0t77/lib/ ]
bad xblock signature ptr/size: FIXABLE
fix (Y/n) ?    N


i don't want to ask user input .

plesae help me .

thanks and regards,
ganesan

Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, output, and code segments.

Last edited by Don Cragun; 07-30-2014 at 05:06 PM.. Reason: Add CODE tags.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filesystem_checking?

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... (0 Replies)
Discussion started by: ganesan_p
0 Replies
Login or Register to Ask a Question