Delsite.sh
- !/bin/sh
- Script to add users to sites
- 30 03 2009
- changed for apache2
- 15 09 2006
- Useage ./adduser.sh sitename.ext user pass
- NB NO WWW before sitename.ext!!!
- NB2 This script doesn't add the user to /etc/postfix/virtual
- 22 04 2009
- Creates empty files with the right permissions in /home/spool/mail
SITENAME=$1 USER=$2 PASS=$3 GROUPNAME=`grep $SITENAME /etc/apache2/listvirts | awk -F '- ' '{ print $2}'`
/usr/sbin/useradd -s /bin/false -g $GROUPNAME -m -d /home/sites/www.$SITENAME/users/$USER $USER echo "$USER:$PASS" > userpasslist cat ./userpasslist | /usr/sbin/chpasswd cat /dev/null > userpasslist
touch /var/spool/mail/$USER chown $USER:$GROUPNAME /var/spool/mail/$USER root@edgarinet:/home/adm_usr/webserveradmin# cat delsite3 er users rm /home/spool/mail/users delgroup group vi /etc/apache2/listvirts/ and get rid of the group vi /etc/postfix/virtual-domains and get rid of the domain vi /etc/postfix/virtual and get rid of anything with the domain and users in it. Afterwards postmap virtual, reload postfix
- rm /home/sites/tripghost.tripany.com/site/sitestats/sitename
rm /home/sites/sitename
- rm /opt/weblog/etc/sitename.conf
rm /etc/awstats/awstats.sitename.conf vi /opt/triphost/sitestatistics.sh and get rid of anything with the domain in it a2dissite sitename /etc/init.d/apache2 reload rm /etc/apache2/sites-available/sitename rm /var/cache/awstats/*sitename*/ -R
- rm /etc/logrotate.d/sitename
delete database and entries from mysql.users and mysql.db use mysql; delete from db where User='%user'; delete from user where User='%user'; drop database %dbname; flush privileges;
lets encrypt certbot delete then select certificate
if the domain is in another certificate, get rid of it from /etc/apache/sites-available/conffile serveraliases and rewriterules. Then get the certificate again.
/etc/bind/named.conf.db /var/cache/bind/soa/zonefile service bind9 restart exit