#!/bin/sh -e

##########################################################################
#   Script description:
#       Remove a user from a supplementary group
#
#   Arguments:
#       username
#       groupname
#       
#   History:
#   Date        Name        Modification
#   2019-10-09  J Bacon     Begin
##########################################################################

usage()
{
    printf "Usage: $0 [-c] username groupname\n"
    exit 1
}


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

if [ $# -lt 2 ]; then
    usage
fi

auto-root-check $0

if ! cluster-check-cron-updates; then
    exit 0
fi

if [ $1 = -c ]; then
    flags=-c
    shift
fi
user_name=$1
group_name=$2
cluster-run $flags "auto-remove-from-group $user_name $group_name" all
