Custom ServerAlias Event Hook

Hey everyone, just put together a quick script for the Event Hooks plugin that will allow you to add custom server aliases upon creation of a new SiteWorx account. As always, feel free to tweak it to suit your needs!


#!/bin/bash
#
# INSTALLATION:
#
# First, ensure the InterWorx CLI is installed via 'yum install interworx-cli'
# 
# Install this script at /usr/local/bin/add_vhost_serveralias.sh
# 
# Enable the Event Hooks plugin in NodeWorx.
# Add the following line to your InterWorx Event Hook Configuration:
# 
#     Ctrl_Nodeworx_Siteworx add /usr/local/bin/add_vhost_serveralias.sh
# 
# Ensure that both this file *and* the Event Hook config are both readable
# and executable by the iworx user:
# 
#     chmod 0770 /usr/local/bin/add_vhost_serveralias.sh
#     chown iworx /usr/local/bin/add_vhost_serveralias.sh
# 
# Change the DOMAIN parameter below to reflect the desired ServerAlias.

if [[ "$iw_master_domain" == "" ]]; then
  exit 1
fi

export IWORX_UNIXUSER=root

~iworx/bin/siteworx.pex -u --login_domain $iw_master_domain -n -c DomainsPointer -a add --domain "DOMAIN.$iw_master_domain" --redir_type server_alias