Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Sasha http://nothing-less.net

How To Fix Bandwidth Updating

If bandwidth stats aren't updating:

/scripts/runweblogs username
/scripts/runlogsnow

How To Fix 403 Errors for public_html

If all the public_html folders got their permissions wrong:

chmod 755 /home/*/public_html

How To Empty /var

If /var is too full:

cd /var
du -sh *


If the log directory is the problem:

rm -f /var/log/*.1
rm -f /var/log/*.2
rm -f /var/log/*.3
rm -f /var/log/*.4


(The /var/log directory contains archived files that always end with a number: exim_mainlog.1. Any file ending with a number can be safely deleted.)

If the problem is with the exim_mainlog being too large, try rotating the logs:

/usr/sbin/logrotate -vf /etc/logrotate.conf


If you get an error about a duplicate log entry:

cd /etc/logrotate.d
rm -rf httpd.rpmorig.log


And try the rotate again.

If the problem is in spool:

cd /var/spool/exim/msglog
rm -rf *

How To Empty /usr

cd /usr/local/apache/domlogs/
rm -rf *.*
/scripts/restartsrv httpd

How To Empty /backup

If /backup/ is too full:

cd /backup/cpbackup/monthly/
rm -f *.gz
/scripts/restartsrv httpd


Check the space after this, and it should be fine.

How To Fix Incorrect Disk Space

/scripts/fixquotas
/scripts/updatemysqlquota

How To Turn Off/On Stats For One Account

http://forums.cpanel.net/showthread.php?t=15967&highlight=urchin

You can edit the:

pico /var/cpane/users/accountname


file and add settings for the stats packages.

skipanalog=1
skipawstats=1
skipwebalizer=1


That will turn them off and override the server setttings.

To update the stats now:

/scripts/runweblogs username
/scripts/runlogsnow

How To Fix Fantastico SourceGuardian Error

http://netenberg.com/forum/viewtopic.php?t=1937
http://www.netenberg.com/forum/viewtopic.php?t=2480

Please make sure to select "Sourceguardian" in WHM -> Tweak Settings (section "Software"). If that doesn't work:

pico /usr/local/cpanel/3rdparty/etc/php.ini


change:
extension_dir = ./ ;

to
extension_dir = ;


and
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

to
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
extension="/usr/local/cpanel/3rdparty/etc/ixed/ixed.lin.4.3.10.pxp"
;;;;;;;;;;;;;;;;;;;;;; 

How To Fix MySQL Error 28

MySQL: 1030: got error 28 from server handler

cd /tmp
df -i /tmp
df -h /tmp


Delete anything that’s not supposed to be there.
Stop all databases:

/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/mysql stop


Then fix tables:

cd /var/lib/mysql


Check each letter for errors:

myisamchk -cs a*/*.MYI


Repair where necessary:

myisamchk -r a*/*.MYI
myisamchk -r b*/*.MYI
myisamchk -r c*/*.MYI
myisamchk -r d*/*.MYI
myisamchk -r e*/*.MYI
myisamchk -r f*/*.MYI
myisamchk -r g*/*.MYI
myisamchk -r h*/*.MYI
myisamchk -r i*/*.MYI
myisamchk -r j*/*.MYI
myisamchk -r k*/*.MYI
myisamchk -r l*/*.MYI
myisamchk -r m*/*.MYI
myisamchk -r n*/*.MYI
myisamchk -r o*/*.MYI
myisamchk -r p*/*.MYI
myisamchk -r q*/*.MYI
myisamchk -r r*/*.MYI
myisamchk -r s*/*.MYI
myisamchk -r t*/*.MYI
myisamchk -r u*/*.MYI
myisamchk -r v*/*.MYI
myisamchk -r w*/*.MYI
myisamchk -r x*/*.MYI
myisamchk -r y*/*.MYI
myisamchk -r z*/*.MYI


Turn everything back on:

/etc/rc.d/init.d/chkservd start
/etc/rc.d/init.d/mysql start