#
# Dependencies of this sub-command
#
remove_files_each_mntpnts_depends()
{
	echo ""
}

#
# Sub-command: remove files on each mount points for each clients
#
subcmd_remove_files_each_mntpnts()
{
	log_debug "subcmd_remove_files_each_mntpnts"

	check_argc $# 4
	check_hostid any $HOSTID
	exec_remote_host_agent $HOSTID - systest::gfarm2fs::remove_files_each_mntpnts "$@"
	[ $? -ne 0 ] && log_error "gfservice systest::gfarm2fs::remove_files_each_mntpnts failed"

	log_debug "end subcmd_remove_files_each_mntpnts"
}

#
# Dependencies of this sub-command agent
#
remove_files_each_mntpnts_agent_depends()
{
	echo "systest::gfarm2fs::remove_files"
}

#
# Sub-command: remove_files_n_each_mntpnts
# Remove files in target dir on each mount points.
#
subcmd_remove_files_each_mntpnts_agent()
{
	log_debug "subcmd_remove_files_each_mntpnts_agent MNTDIR_PREFIX=$1" \
		"COUNT=$2 TARGET_DIR=$3"

	MNTDIR_PREFIX=$1
	COUNT=$2
	TARGET_DIR=$3
	shift 3

	MNTDIR_PREFIX_ESC=`echo $MNTDIR_PREFIX | sed -e 's|/|\\\\/|g'`
	for I in `df|awk "/$MNTDIR_PREFIX_ESC/{print \\\$6}"|sort|head -$COUNT`; do
		subcmd_remove_files_agent "$I/$PROGHOST/$I/$TARGET_DIR" "$@"
		[ $? -ne 0 ] && log_error "remove_files_each_mntpnts failed"
	done

	log_debug "end subcmd_remove_files_each_mntpnts_agent"
}
