calls 'service resman start ' rather than the *limit scripts directly
[util-vserver.git] / scripts / vuseradd
index 21e5e50..e27e638 100755 (executable)
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 2004  The Trustees of Princeton University (Trustees).
 #
-# $Id: vuseradd,v 1.10 2004/10/11 19:38:48 mef Exp $
+# $Id: vuseradd,v 1.13 2004/10/20 19:01:52 mlhuang Exp $
 #
 
 : ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars}
@@ -29,9 +29,12 @@ groupadd slices 2>/dev/null || :
 # add user
 useradd -g slices -s /bin/vsh $NAME
 
-# automount keys (eval expands ~)
-eval rm -rf ~$NAME/.ssh
-eval ln -nsf /var/pl_sshd/keys/$NAME ~$NAME/.ssh
+# automount keys
+if [ -d "/var/pl_sshd/keys/$NAME" ]; then
+    # (eval expands ~)
+    eval rm -rf ~$NAME/.ssh
+    eval ln -nsf /var/pl_sshd/keys/$NAME ~$NAME/.ssh
+fi
 
 USERID=$(awk -F: "\$1 == \"$NAME\" { print \$3 }" < /etc/passwd)
 GROUPID=$(awk -F: "\$1 == \"slices\" { print \$3 }" < /etc/group)
@@ -85,3 +88,6 @@ if [ -d "$VROOTDIR/$NAME" ] ; then
        echo "$NAME     ALL=(ALL)       ALL" >> "$VROOTDIR/$NAME/etc/sudoers"
     fi
 fi
+
+# turn resource management on for vserver $NAME
+service resman start $NAME