#!/bin/sh -e

##########################################################################
#   Script description:
#       
#   Arguments:
#       
#   Returns:
#       
#   History:
#   Date        Name        Modification
#   2013-12-31  root        Begin
##########################################################################

usage()
{
    printf "Usage: $0 username\n"
    exit 1
}


##########################################################################
#   Main
##########################################################################

cluster-head-check $0

set +e

if [ $# != 1 ]; then
    usage
fi

user_name="$1"

# Add user and group to I/O and compute nodes
for node in `cluster-all-nodes`; do
    printf "$node $user_name\n"
    if ! node-sync-users $node $user_name; then
	printf "Warning: Unable to sync user to $node.\n"
    fi
done
