Create A Group - Overland Storage SnapServer Administrator's Manual

Hide thumbs Also See for SnapServer:
Table of Contents

Advertisement

SnapServer/GuardianOS 7.5 Administrator's Guide

Create a Group

# if the group does not exist then create it
if ! $CLI group get group-name="$1" > /dev/null 2>&1; then
return 1
else
echo "Group '$1' already exists."
fi
return 0
}
# usage: 'adduser2group <user_name> <group_name>'
adduser2group()
{
Add the User to the Group
# if both the user and the group exist add the user as a member of this group
if $CLI user get user-name="$1" > /dev/null 2>&1; then
if $CLI group get group-name="$2" > /dev/null 2>&1; then
echo "Adding user '$1' to group '$2' ..."
$CLI group member add user-name="$1" group-name="$2" > /dev/null 2>&1
return 1
fi
fi
return 0
}
# usage: 'mkshare <share_name> <share_volume>'
mkshare()
{
Create a Share
# if the share does not exist create it
if ! $CLI share get share-name="$1" > /dev/null 2>&1; then
echo "Creating share '$1' ..."
$CLI share create share-name="$1" share-volume="$2" > /dev/null 2>&1
return 1
else
echo "Share '$1' already exists."
fi
return 0
}
# usage: 'rmuser <user_name>'
rmuser()
{
Delete the User
# if the user exists then delete it
if $CLI user get user-name="$1" > /dev/null 2>&1; then
echo "Deleting user '$1' ..."
10400541-001
echo "Creating group '$1' ..."
$CLI group create group-name="$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Creation of group '$1' failed."
fi
if [ $? -ne 0 ]; then
echo "Adding user '$1' to group '$2' failed."
fi
if [ $? -ne 0 ]; then
echo "Creating share '$1' failed."
fi
$CLI user delete user-name="$1" > /dev/null 2>&1
©2008-14 Overland Storage, Inc.
E - Command Line Interface
262

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents