Saturday, November 20, 2010

Cpanel upcp error

Issue: root@server [~]# /scripts/upcp --force
/scripts/upcp syntax OK
Running Futex Check/Fix......Done
Undefined subroutine &Cpanel::Update::automatic_updates_enabled called at /scripts/upcp line 273.

Solution: wget -O /root/updatenow.static http://httpupdate.cpanel.net/cpanelsync/RELEASE/scripts/updatenow.static && perl /root/updatenow.static --manual

Then run /scripts/upcp --force.

It should fix it!!

Wednesday, October 27, 2010

mount/Unmount a partition in Linux

I was trying to umount a partition, it gave me error saying the device is busy and un mount was not working. I then started to troubleshoot this and came to the conclusion that something was still accessing the partition and hence the Linux was not allowing me to unmount it. So what do you do to know what process is using this? There are couple of command utilities that can assist you in this. One is lsof and the other one is fuser,  so how do you use this? lets see that below.

# lsof /dev/sda2

 or
 
# fuser -m /dev/sda2

it will list you the process that is using that partition, either stop the process or kill it and then you can umount it. Hope it helps ;)

Friday, October 1, 2010

Recovering files/settings from a cPanel server from a Harddisk failure/Crash


Bad things happen...Same is the case with a server, Suppose you have a cPanel server and one fine morning, you get this alert.. Site DOWN!!!

oops your hdd crashed? well dont panick... contact your datacentre and get the same OS installed on a new hdd, lets do the data recovery real fast!


Once the server is UP with new OS, install cPanel and connect your old hdd as slave and mount it to /oldHD





# mount /dev/sdb1 /oldHD

Run these rsync commands to move everything over;


# rsync -vrplogDtH /oldHD/usr/local/apache/conf /usr/local/apache
# rsync -vrplogDtH /oldHD/var/named /var
# rsync -vrplogDtH /oldHD/home/* /home
# rsync -vrplogDtH /oldHD/usr/local/cpanel /usr/local
# rsync -vrplogDtH /oldHD/var/lib/mysql /var/lib
# rsync -vrplogDtH /oldHD/var/cpanel /var
# rsync -vrplogDtH /oldHD/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
# rsync -vrplogDtH /oldHD/var/log/bandwidth /var/log
# rsync -vrplogDtH /oldHD/usr/local/frontpage /usr/local
# rsync -vrplogDtH /oldHD/var/spool/cron /var/spool
# rsync -vrplogDtH /oldHD/root/.my.cnf /root
# rsync -vrplogDtH /oldHD/etc/httpd/conf/httpd.conf /etc/httpd/conf
# rsync -vrplogDtH /oldHD/etc/sysconfig/network /etc/sysconfig



almost done.. now some configuration files need to be copied.

go to the old etc directory


# cd /oldHD/etc
# rsync -vrplogDtH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts /etc

Once this is complete run



# /scripts/fixeverything
# /scripts/upcp –force
# /scripts/easyapache
everything should be working fine now :) 

Thursday, July 8, 2010

Extended logging in Exim

1. Open /etc/exim.confRemove Formatting from selection


#vi /etc/exim.conf




2. Enter the following 


log_selector=+all


3. Save the file and change its attribute


# chattr + i  /etc/exim.conf


4. Restart Exim


# /etc/init.d/exim restart


Thats it! now check the exim log


# tail -f /var/log/exim_mainlog