Skip to content

Instantly share code, notes, and snippets.

@pad92
Created July 26, 2012 13:16
Show Gist options
  • Save pad92/3181995 to your computer and use it in GitHub Desktop.
Save pad92/3181995 to your computer and use it in GitHub Desktop.
Create vhost conf from list
#!/usr/bin/env sh
PATH="/etc/apache2/sites-available"
if [ "$#" -gt "0" ]; then
for VHOST in $@; do
if [ -f "$PATH/$VHOST" ]; then
/bin/rm "$PATH/$VHOST";
fi
/bin/cp "$PATH/default" "$PATH/$VHOST"
done
else
echo "Usage: $0 domaine1 domaine2 etc ..."
echo
echo "You can get servername list with :"
echo "grep ^ServerName httpd.conf | grep -v localhost | cut -d' ' -f2 | tr '\n' ' '"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment