Scripts in SnapCLI
Appendix B Command Line Interface
155
Create a user
# if the user does not exist then create it
if ! $CLI user get user-name="$1" > /dev/null 2>&1; then
echo "Creating user '$1' ..."
$CLI user create user-name="$1" password="$2" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Creation of user '$1' failed."
return 1
fi
else
echo "User '$1' already exists."
fi
return 0
}
# usage: 'mgroup <group_name>'
mkgroup()
{
Create a group
# if the group does not exist then create it
if ! $CLI group get group-name="$1" > /dev/null 2>&1; then
echo "Creating group '$1' ..."
$CLI group create group-name="$1" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Creation of group '$1' failed."
return 1
fi
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
if [ $? -ne 0 ]; then
echo "Adding user '$1' to group '$2' failed."
return 1
fi
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' ..."
Содержание 5325301656 - Snap Server 14000 NAS
Страница 2: ......
Страница 76: ...Disks and Units 62 Snap Server Administrator Guide ...
Страница 92: ...Creating iSCSI Disks 78 Snap Server Administrator Guide ...
Страница 108: ...Security Guides 94 Snap Server Administrator Guide ...
Страница 144: ...Unicode and Expansion Arrays 130 Snap Server Administrator Guide ...
Страница 164: ...Off the Shelf Backup Solutions for the Snap Server 150 Snap Server Administrator Guide ...
Страница 172: ...Scripts in SnapCLI 158 Snap Server Administrator Guide ...
Страница 206: ...192 Snap Server Administrator Guide ...
Страница 224: ...210 Snap Server Administrator Guide ...