Adaptec 5325301656 Administration Guide - Page 169
Scripts in SnapCLI, Appendix B, Command Line Interface, Create a user, Create a group
UPC - 753253016563
View all Adaptec 5325301656 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 169 highlights
Scripts in SnapCLI # 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 } Create a user # usage: 'mgroup ' mkgroup() { # 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 } Create a group # usage: 'adduser2group ' 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 ' mkshare() { # if the share does not exist create it if ! $CLI share get share-name="$1" > /dev/null 2>&1; then echo "Creating share '$1' ..." Create a share Appendix B Command Line Interface 155