#!/sbin/sh
# @(#)src/unix/pagecache/sol/common/cmd/vxfs/fsckall/fsckall.sh	3.3 08/21/01 00:58:24
#ident "@(#)vxfs:src/unix/pagecache/sol/common/cmd/vxfs/fsckall/fsckall.sh	3.3"
#
# (c) Copyright 1991-2003 VERITAS Software Corporation. All rights reserved.
#


# Produce a list of the file systems that are not already
# mounted.
#

for fsckdev in $* ; do
	/usr/lib/fs/vxfs/fsck -m $fsckdev >/dev/null 2>&1
	if [ $? -eq 32 ]; then
		vxfs_fscklist="$vxfs_fscklist $fsckdev"
	fi
done

#
# Check the file systems in parallel
#

if [ "$vxfs_fscklist" ]; then
	echo "checking vxfs filesystems"
	/usr/lib/fs/vxfs/fsck -y -o p $vxfs_fscklist
	case $? in

	0|40|33)	# file system OK
			exit 0
			;;

	*)	# couldn't fix the filesystems - return an error
		exit 1
		;;
	esac
fi

exit 0
