Various CPanel Articles and Notes - more a notepad than best methods. As I transfer to click-administration after sometime of webmin + vi, notes are needed.
Use this to move/copy users between cpanel servers - last time when moving users by hand it took 2 days to move what I can now in about 10 minutes (exclude tar.gz time) and more importantly for users, passwords remain the same.
Take backup of the accounts using the following script: ( in source server)
# /scripts/pkgacct username
This will create a backup file under /home with name cpmove-username.tar.gz
# /scripts/restorepkg username
Bind zones are ok to be edited directly: increment the serial number, verify changes with service named check, then if all is ok, service named restart - tried to use rndc reload example.com, but it gave some error.
To get www2 to stick for an apache server config w/o any other mods, and for testing, I added as a server alias to the httpd.conf file, then ran /usr/local/cpanel/bin/apache_conf_distiller --update, then /usr/local/cpanel/bin/build_apache_conf
At the end of the acl_mail block add a delay for everyone
accept
delay = 5s
Add this to the end of the acl_connect block
# Lets delay everyone for now to 8s for connecting...
accept
delay = 8s
/etc/custom_exim_system_filter file. This is global on the server for incoming email. Additionally, I have seen emails over 4 "pluses" are definitely spam the past 2 weeks since implemented this.
if $message_headers matches "X-Spam-Bar: \\\\+\\\\+\\\\+\\\\+" then headers add "Old-Subject: $h_subject:" headers remove "Subject" headers add "Subject: *Spam* $h_old-subject" headers remove "Old-Subject" endifCpanel was overwriting my changes to the default file, so copied, added this chunk then configured cpanel to use my version of the file - again, to prevent overwriting when cpanel updates.
A long time ago my cpanel server was a mysql slave - I had not "deconfigured" this and tonight upon restart wiped out about 15 databases - mostly mine, plus a couple others. I restored all of them from hour old backups I just made. If I had not just done the backups, I'd lost a day or so..
Again, importance of backups and for "this is just a minor tweak" and "just a quick restart" .. yeah. Backup first.
So, summary was to disable being a slave server, then tar -xzf the backups, re-create the DB's, restore the DB's, restore permissions..
# mv master.info mcmaster.infooo
root@vps2 [//home/unpack/cpmove-user/mysql]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 396 Server version: 5.0.77-community MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show slave status\G Empty set (0.00 sec) mysql> quit Bye
Thanks to Sun MySQL Forum at the MySQL Forum
/home/unpack/cpmove-user/mysql and I ran this command to blitz create all the user databases for the user:for sql in `ls user*`; do sql=`echo $sql | sed 's/\.sql//'`; echo "create database $sql; >> makedb.sql"; done; mysql < makedb.sql
for sql in `ls user*`; do sqldb=`echo $sql | sed 's/\.sql//'`; mysql $sqldb < $sql; done
mysql.sql# mysql < ../mysql.sql
This restored about 15 databases very quickly with original permissions, passwords and I was able to get right back to work.