This is an old revision of the document!


1. delete unused domains A good start is to go through apache2 config:

 grep ^Use domains.conf |cut -f4 -d\
 

for a small number of domains, it is pretty quick and 100% correct going through the list manualy

   domains = `grep ^Use domains.conf |cut -f4 -d\ | xargs`
   for i in $domains; do
      host $d
      read yn
      if [ "${yn}foo" != 'nfoo' ]; then
          echo $d >>/tmp/ws2.alive
      fi
   done

Save this list for later editing the DNS.

2. remove dead databases

cat /tmp/ws2.alive |tr -s . _ |sort >/tmp/db.alive
ls -1 /var/lib/mysql/ > /tmp/db.old
domains =`diff -u db.old db.alive | grep ^-|tr -s _ .|cut -f2 -d-`
 
for i in $domains; do host $i|grep 146.255.31.12 -q && echo $i; done >> /tmp/db.alive
   sort db.alive >db2.alive
These are dead 
 
   diff -u db.old db2.alive | sed -n 's/^-\(.*\)/drop database \1;/p'
 
xhost/migration-web.1581363036.txt.gz · Last modified: 2020/02/10 20:30 by admin