Modification/suppression/activation/desactivation conf web OK
This commit is contained in:
		
							parent
							
								
									527c0f3f0e
								
							
						
					
					
						commit
						5e8125a697
					
				| 
						 | 
				
			
			@ -356,9 +356,9 @@ etc/alternc/phpmyadmin.inc.php -text
 | 
			
		|||
etc/alternc/postfix-slave.cf -text
 | 
			
		||||
etc/alternc/postfix.cf -text
 | 
			
		||||
etc/alternc/templates/alternc/bureau.conf -text
 | 
			
		||||
etc/alternc/templates/apache2/local.conf -text
 | 
			
		||||
etc/alternc/templates/apache2/panel.conf -text
 | 
			
		||||
etc/alternc/templates/apache2/redirect.conf -text
 | 
			
		||||
etc/alternc/templates/apache2/vhost.conf -text
 | 
			
		||||
etc/alternc/templates/apache2/webmail.conf -text
 | 
			
		||||
etc/alternc/templates/bind/automatic.conf -text
 | 
			
		||||
etc/alternc/templates/bind/named.conf.options -text
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibil
 | 
			
		|||
-- TODO modify mysql.sh to add this changes
 | 
			
		||||
alter table domaines add column dns_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE';
 | 
			
		||||
alter table domaines add column dns_result varchar(255) not null default '';
 | 
			
		||||
alter table sub_domaines add column web_action enum ('OK','UPDATE','DELETE') NOT NULL default 'UPDATE';
 | 
			
		||||
alter table sub_domaines add column web_action enum ('OK','UPDATE','ENABLE','DISABLE','DELETE') NOT NULL default 'UPDATE';
 | 
			
		||||
alter table sub add column dns_result varchar(255) not null default '';
 | 
			
		||||
drop table sub_domaines_standby;
 | 
			
		||||
drop table domaines_standby;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,7 @@
 | 
			
		|||
# Init some other vars
 | 
			
		||||
MYSQL_DO="/usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e "
 | 
			
		||||
DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log"
 | 
			
		||||
VHOST_FILE="$VHOST_DIR/vhosts_all.conf" 
 | 
			
		||||
 | 
			
		||||
# Some usefull miscellaneous shell functions
 | 
			
		||||
print_domain_letter() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -134,7 +134,7 @@ host_change_enable() {
 | 
			
		|||
 | 
			
		||||
    if [ ! -e "$TARGET" ] && [ -e "$SOURCE" ] ; then
 | 
			
		||||
        # If the "target" file do not exist and the "source" file exist
 | 
			
		||||
        rename -f "$SOURCE" "$TARGET"
 | 
			
		||||
        mv -f "$SOURCE" "$TARGET"
 | 
			
		||||
    else
 | 
			
		||||
        return 2
 | 
			
		||||
    fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,8 +43,7 @@ $MYSQL_DO "update sub_domaines sd, domaines d set sd.web_action = 'DELETE' where
 | 
			
		|||
# Sub_domaines we want to delete
 | 
			
		||||
# sub_domaines.web_action = delete
 | 
			
		||||
for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where web_action ='DELETE';") ; do
 | 
			
		||||
    echo $sub
 | 
			
		||||
    # TODO Do the conf
 | 
			
		||||
    host_delete $sub
 | 
			
		||||
    # TODO Update the entry in the DB with the result and the action
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,11 +57,21 @@ params=$( $MYSQL_DO "
 | 
			
		|||
  and dt.only_dns = false
 | 
			
		||||
  ;")
 | 
			
		||||
for sub in $params;do
 | 
			
		||||
    echo  host_create $(echo $sub|tr '|µ' ' ')
 | 
			
		||||
    host_create $(echo $sub|tr '|µ' ' ')
 | 
			
		||||
    # TODO Update the entry in the DB with the result and the action
 | 
			
		||||
done
 | 
			
		||||
unset IFS
 | 
			
		||||
 | 
			
		||||
# Domaine to enable
 | 
			
		||||
for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where sd.web_action ='ENABLE' ;");do
 | 
			
		||||
    host_enable $sub
 | 
			
		||||
    # TODO Update the entry in the DB with the result and the action
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Domains to disable
 | 
			
		||||
for sub in $( $MYSQL_DO "select if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine) from sub_domaines sd where sd.web_action ='DISABLE' ;");do
 | 
			
		||||
    host_disable $sub
 | 
			
		||||
    # TODO Update the entry in the DB with the result and the action
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Domains we do not want to be the DNS serveur anymore :
 | 
			
		||||
# domaines.dns_action = UPDATE and domaines.gesdns = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -87,21 +96,23 @@ for dom in $( $MYSQL_DO "select domaine from domaines where dns_action = 'DELETE
 | 
			
		|||
done
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo Exitbefore reload everything, we are testing, FUCK
 | 
			
		||||
rm "$LOCK_FILE"
 | 
			
		||||
exit 1
 | 
			
		||||
# Concat the apaches files
 | 
			
		||||
local tempo=$(mktemp /tmp/alternc-vhost.XXXXX)
 | 
			
		||||
find "$VHOST_DIR" -type f -iname "*.conf" -exec cat '{}' >> "$tempo" \;
 | 
			
		||||
tempo=$(mktemp /tmp/alternc-vhost.XXXXX)
 | 
			
		||||
find "$VHOST_DIR" -mindepth 2 -type f -iname "*.conf" -exec cat '{}' > "$tempo" \;
 | 
			
		||||
if [ $? -ne 0 ] ; then
 | 
			
		||||
  log_error " web file concatenation failed"
 | 
			
		||||
fi
 | 
			
		||||
if [ ! -w "$VHOST_FILE" ] ; then
 | 
			
		||||
touch "$VHOST_FILE"
 | 
			
		||||
if [ ! -w "$VHOST_FILE" ] ; then
 | 
			
		||||
  log_error "cannot write on $VHOST_FILE"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
mv "$tempo" "$VHOST_FILE"
 | 
			
		||||
 | 
			
		||||
echo Exitbefore reload everything, we are testing, FUCK
 | 
			
		||||
rm "$LOCK_FILE"
 | 
			
		||||
exit 1
 | 
			
		||||
 | 
			
		||||
# Reload web and dns
 | 
			
		||||
alternc_reload all
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue