X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=usr%2Flocal%2Fbin%2Fvserver-create;h=b3a30e50261c2d2f591508c7d16028e47f208372;hb=6189f9d3ce5b877f92266d20a58b90ef0033f00d;hp=7311ab185534a9b3367a162df1afbb502320ed2a;hpb=10284eae2f18c41fd231ab541f933835b8c1c362;p=matthijs%2Fservers%2Fdrsnuggles.git diff --git a/usr/local/bin/vserver-create b/usr/local/bin/vserver-create index 7311ab1..b3a30e5 100755 --- a/usr/local/bin/vserver-create +++ b/usr/local/bin/vserver-create @@ -14,6 +14,12 @@ IP_RANGE=10.42.0. INTERFACE=dummy0 # The netmask for the address NETMASK=24 +HOSTS_VSERVER=dns +# The hosts file to which an entry for the new vserver should be added. Can be +# left empty to not record the new vserver anywhere. +HOSTS_FILE=$VSERVERS_CONF/$HOSTS_VSERVER/vdir/etc/hosts +# Any extra commands to execute after creating the vserver +POST_EXEC="sudo vserver $HOSTS_VSERVER exec /usr/bin/killall -HUP dnsmasq" function usage() { @@ -79,3 +85,11 @@ CONF_FOR_GIT=`echo $VSERVERS_CONF/$NAME | sed "s#^/*##"` # Commit the configuration (cd /; git add $CONF_FOR_GIT) (cd /; git commit $CONF_FOR_GIT --edit --message "vserver: Add $NAME vserver configuration.") + +if [ -n "$HOSTS_FILE" ]; then + sudo sh -c "echo '$IP $NAME' >> '$HOSTS_FILE'" +fi + +if [ -n "$POST_EXEC" ]; then + $POST_EXEC +fi