Specifications

Scripts in SnapCLI
180 SnapServer Administrator Guide
$CLI group delete group-name="$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Deletion of group '$1' failed."
return 1
fi
else
echo "Group '$1P' does not exist."
fi
return 0
}
# usage: 'rmshare <share_name>'
rmshare()
{
Delete the share
# if the share exists delete it
if $CLI share get share-name="$1" > /dev/null 2>&1; then
echo "Deleting share '$1' ..."
$CLI share delete share-name="$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Deletion of share '$1' failed."
return 1
fi
else
echo "Share '$1' does not exist."
fi
return 0
}
Create a user, group, and share; then add the user to the group
##############
# Main #
##############
# create a user, a group and a share and add the user to the group
mkuser "$USER" "$PASSWORD"
mkgroup "$GROUP"
adduser2group "$USER" "$GROUP"
mkshare "$SHARE" "$VOLUME"
#remove the group, the user and the share
rmgroup "$GROUP"
rmuser "$USER"
rmshare "$SHARE"