Odd, not letting me attach the script either, let me try posting it this way:
#!/bin/bash
echo "Enter the username:"
read WUSERNAME
ACCESS_FILE="/etc/awstats/awstats.pwd"
echo "Enter the password:"
read PASSWORD
echo "Enter the main domain:"
read DOMAIN
STAT_DIR="/home/httpd/vhosts/$DOMAIN/httpdocs/awstats"
ACCESSLOGDIR="/home/httpd/vhosts/$DOMAIN/statistics/logs/access_log"
#echo "Enter aliases separated by space:"
#read ALIASES
# Create the statistics directory
if [ -d $STAT_DIR ]; then
echo "Statistics dir already exist"
else
mkdir $STAT_DIR
chown apache:apache $STAT_DIR
chmod 770 $STAT_DIR
fi
# Create the virtual host awstats.conf
cat /etc/awstats/awstats.model.conf | \
sed -e "s/\\\$DOMAIN/$DOMAIN/g" | sed -e "s/\\\$USERNAME/$WUSERNAME/g" | sed -e "s/\\\$ALIASES/$ALIASES/g" > \
"/etc/awstats/awstats.www.$DOMAIN.conf"
# Add user/password to password file
if [ -e $ACCESS_FILE ]; then
/usr/bin/htpasswd -bm $ACCESS_FILE $WUSERNAME $PASSWORD
else
/usr/bin/htpasswd -bm -c $ACCESS_FILE $WUSERNAME $PASSWORD
fi
#!/bin/bash
echo "Enter the username:"
read WUSERNAME
ACCESS_FILE="/etc/awstats/awstats.pwd"
echo "Enter the password:"
read PASSWORD
echo "Enter the main domain:"
read DOMAIN
STAT_DIR="/home/httpd/vhosts/$DOMAIN/httpdocs/awstats"
ACCESSLOGDIR="/home/httpd/vhosts/$DOMAIN/statistics/logs/access_log"
#echo "Enter aliases separated by space:"
#read ALIASES
# Create the statistics directory
if [ -d $STAT_DIR ]; then
echo "Statistics dir already exist"
else
mkdir $STAT_DIR
chown apache:apache $STAT_DIR
chmod 770 $STAT_DIR
fi
# Create the virtual host awstats.conf
cat /etc/awstats/awstats.model.conf | \
sed -e "s/\\\$DOMAIN/$DOMAIN/g" | sed -e "s/\\\$USERNAME/$WUSERNAME/g" | sed -e "s/\\\$ALIASES/$ALIASES/g" > \
"/etc/awstats/awstats.www.$DOMAIN.conf"
# Add user/password to password file
if [ -e $ACCESS_FILE ]; then
/usr/bin/htpasswd -bm $ACCESS_FILE $WUSERNAME $PASSWORD
else
/usr/bin/htpasswd -bm -c $ACCESS_FILE $WUSERNAME $PASSWORD
fi