#!/bin/bash if [ "$#" -lt 3 ] ; then echo "" echo "Usage : addvirtual dominio utente nomedatabase tipodatabase[db2|ps]" echo "" exit 0 fi if [ -f /etc/apache2/conf.d/vhost.d/www.$1.conf ] ; then echo "" echo "Il virtual server esiste gia'" echo "" exit 0 fi if [ -d /home/www/www.$1 ] ; then echo "" echo "La directory sotto /home/www esiste gia'" echo "" exit 0 fi if [ ! -f /opt/template/virtual.conf ] ; then echo "" echo "Il file /opt/template/virtual.conf non esiste" echo "" exit 0 fi if [ -f /etc/apache2/conf.d/vhost.xml/$1.xml ] ; then echo "" echo "Il file /etc/apache2/conf.d/vhost.xml/$1.xml esiste gia'" echo "" exit 0 fi if [ ! -f /opt/template/template_$4.xml ] ; then echo "" echo "Il file /opt/template/template_$4.xml non esiste" echo "" exit 0 fi # Controllo se l'utente esiste cat /etc/passwd | grep $2 > /dev/null && echo "L'utente esiste gia'" && exit 0 # Crea il file di configurazione per http sed -e s/LLLL/$1/g /opt/template/virtual.conf > /etc/apache2/conf.d/vhost.d/www.$1.conf # Crea il file di configurazione per xml sed -e s/LLLL/$1/g /opt/template/template_$4.xml | sed -e s/DDDD/$3/g - > /etc/apache2/conf.d/vhost.xml/$1.xml # Crea le directory di lavoro cp -a /home/www/skel /home/www/www.$1 # Crea il file di configurazione per Webalizer sed -e s/LLLL/$1/g /opt/template/webalizer.conf > /home/www/www.$1/logs/webalizer.$1.conf # Crea il file di configurazione per LogRotate sed -e s/LLLL/$1/g /opt/template/logrotate.conf > /home/www/www.$1/logs/logrotate.$1.conf # Crea utente useradd --shell /bin/false --home /home/www/www.$1/htdocs $2 # Assegna i permessi alle cartelle pubbliche chown -R $2 /home/www/www.$1/htdocs # Crea password passwd $2
Add new attachment
Only authorized users are allowed to upload new attachments.
«
This particular version was published on 14-Apr-2010 14:30 by RaffaelePedrini.