Password File
/etc/passwd
Log Files
/var/log/
Installing Stuff
/usr/src is where you do work such as installing packages
Plesk Backups
/var/lib/psa/dumps/1/
Plesk Logs
/usr/local/psa/admin/logs
Monday, April 26, 2010
Sunday, April 25, 2010
Awstats Notes
Awstats for Plesk
Config files are located at /etc/awstats
To update stats on one domain run
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=blabla.com
For all domains run
/usr/local/psa/admin/sbin/statistics --calculate-all
If there is an error run strace and then the command:
strace /usr/local/psa/admin/sbin/statistics
Config files are located at /etc/awstats
To update stats on one domain run
/usr/local/psa/admin/sbin/statistics --calculate-one --domain-name=blabla.com
For all domains run
/usr/local/psa/admin/sbin/statistics --calculate-all
If there is an error run strace and then the command:
strace /usr/local/psa/admin/sbin/statistics
Saturday, April 24, 2010
find all files over a certain size
cd /
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n | mail -s "files over 10000k" cschwieterman@xxxxxxxxxxxxx.com
cd /
find / -type f -size +50000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n
Change the 10000k or 50000k to the size you need.
find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n | mail -s "files over 10000k" cschwieterman@xxxxxxxxxxxxx.com
cd /
find / -type f -size +50000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n
Change the 10000k or 50000k to the size you need.
Friday, April 23, 2010
Update Plesk (not tested)
/usr/local/psa/admin/bin/autoinstaller --enable-xml-output --source-type=plesk --target=/root/psa --select-release-id=PLESK_8_6_0 --install-component=base
Thursday, April 22, 2010
Find all directories Over 1 GB
I use this often when my server reaches max capacity.
[root@localhost]# du -h / | grep ^[0-9.]*G
[root@localhost]# du -h / | grep ^[0-9.]*G
Wednesday, April 21, 2010
Tuesday, April 20, 2010
Custom Commands
Here is a list of custom commands I usually create on linux based systems.
htr is a custom command that will restart apache
echo "service httpd restart" > /usr/bin/htr ; chmod 700 /usr/bin/htr
awstats is a custom command that will update ALL STATS for all sites that have a config file
echo "/usr/local/awstats/tools/awstats_updateall.pl now" > /usr/bin/awstats ; chmod 700 /usr/bin/awstats
mail-ps is a custom command to mail the current process list to statusupdate@xxxxxxx.net
echo "ps auxw | mail -s \"Server: Current Processes\" statusupdate@xxxxxxx.net" > /usr/bin/mail-ps ; chmod 700 /usr/bin/mail-ps
mail-netstat is a custom command to mail the current open port list to statusupdate@xxxxxxx.net
echo "netstat -nape | mail -s \"Server: Current Active Internet Connections\" statusupdate@xxxxxxx.net" > /usr/bin/mail-netstat ; chmod 700 /usr/bin/mail-netstat
htr is a custom command that will restart apache
echo "service httpd restart" > /usr/bin/htr ; chmod 700 /usr/bin/htr
awstats is a custom command that will update ALL STATS for all sites that have a config file
echo "/usr/local/awstats/tools/awstats_updateall.pl now" > /usr/bin/awstats ; chmod 700 /usr/bin/awstats
mail-ps is a custom command to mail the current process list to statusupdate@xxxxxxx.net
echo "ps auxw | mail -s \"Server: Current Processes\" statusupdate@xxxxxxx.net" > /usr/bin/mail-ps ; chmod 700 /usr/bin/mail-ps
mail-netstat is a custom command to mail the current open port list to statusupdate@xxxxxxx.net
echo "netstat -nape | mail -s \"Server: Current Active Internet Connections\" statusupdate@xxxxxxx.net" > /usr/bin/mail-netstat ; chmod 700 /usr/bin/mail-netstat
Sunday, April 18, 2010
How to reload the vhost.conf and vhost_ssl.conf files
I have several websites that I administer on Mediatemple and the following comes in handy.
Create the vhost.conf file in /var/www/vhosts/mt-example.com/conf.
Save the file and run this command to force Plesk to see the changes:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mt-example.com
Restart Apache to load the new changes:
service httpd graceful
To reconfigure server
/usr/local/psa/admin/sbin/websrvmng -a -v
Create the vhost.conf file in /var/www/vhosts/mt-example.com/conf.
Save the file and run this command to force Plesk to see the changes:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=mt-example.com
Restart Apache to load the new changes:
service httpd graceful
To reconfigure server
/usr/local/psa/admin/sbin/websrvmng -a -v
Saturday, April 17, 2010
Change Permissions of files (chmod)
Here's another from my scrap notes.
chmod 000 filename.abc
(defaults are usually 755 for folders, 644 for files)
Numbers correspond to users. 1st=Owner; 2nd=Group; 3rd=Other
(-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r--r-- = 644, etc.)
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied
chmod 000 filename.abc
(defaults are usually 755 for folders, 644 for files)
Numbers correspond to users. 1st=Owner; 2nd=Group; 3rd=Other
(-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r--r-- = 644, etc.)
7 = Read + Write + Execute
6 = Read + Write
5 = Read + Execute
4 = Read
3 = Write + Execute
2 = Write
1 = Execute
0 = All access denied
Friday, April 16, 2010
qmail
Flush the queue and send all mail
killall -ALRM qmail-send
I use this every now and then on my failover mail queue.
killall -ALRM qmail-send
I use this every now and then on my failover mail queue.
Thursday, April 15, 2010
Common MySQL Commands
From root command prompt
Mysql Prompt: mysql -uadmin -p`cat /etc/psa/.psa.shadow`
Cool commands:
show variables like 'have_query_cache';
show variables like 'query%';
SHOW STATUS LIKE 'Qcache%';
FLUSH QUERY CACHE - defrag
RESET QUERY CACHE - empty
MySQL Start
/etc/init.d/mysqld start
To update mysql root password:
mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;
Mysql Prompt: mysql -uadmin -p`cat /etc/psa/.psa.shadow`
Cool commands:
show variables like 'have_query_cache';
show variables like 'query%';
SHOW STATUS LIKE 'Qcache%';
FLUSH QUERY CACHE - defrag
RESET QUERY CACHE - empty
MySQL Start
/etc/init.d/mysqld start
To update mysql root password:
mysql
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;
Wednesday, April 14, 2010
Common Linux Commands I Use
Processes
To view current processes running on the system use the following commands:
ps auxw # USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ps auxw | grep | sort –n
Netstat
To view open connections and ports use netstat.
Netstat –nape
Outputting to Null
> /dev/null
TAR
To tar a file:
tar -cf nameOfTar.tar Folder1 Folder2
To untar a file
tar -xvf nameOfTar.tar
To untar a gzip file
tar -zxvf nameOfTar.tar.gz
Touch
A simple command that can create a file quickly
touch /var/log/somelogname.log
chmod 700 /var/log/somelogname.log
echo “this is a log file” > /var/log/somelogname.log
cat /var/log/somelogname.log
HTTPD Restart
/etc/init.d/httpd restart
Server Version
cat /etc/redhat*
CentOS release 4.5 (Final)
2)On SUSE Linux,
$cat /etc/SuSE-release
Top
Top displays a lot of system information in real time. CPU/memory/etc. It is a resource hog though.
top
Free Memory
free –m // memory
FTP
ftp server.com
use ftp -i server.com to remove confirmations. For example, downloading multiple files requires the use of mget *.*. Without logging in with -i it will force you to acknowledge the download of each file.
Reboot
shutdown -r now is reboot
Nice
Usage: nice [OPTION] [COMMAND [ARG]...]
Run COMMAND with an adjusted scheduling priority.
With no COMMAND, print the current scheduling priority. ADJUST is 10
by default. Range goes from -20 (highest priority) to 19 (lowest).
-n, --adjustment=ADJUST increment priority by ADJUST first
--help display this help and exit
--version output version information and exit
Example:
cd /; nice -n 15 /usr/bin/clamscan -r | mail -s "Server: AV Scan Results" chad@xxxxxxxxxxxx.com
Display resources
cat /proc/user_beancounters
egrep "failcnt|numiptent" /proc/user_beancounters
httpd configtest
/etc/init.d/httpd configtest
To view current processes running on the system use the following commands:
ps auxw # USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ps auxw | grep
Netstat
To view open connections and ports use netstat.
Netstat –nape
Outputting to Null
> /dev/null
TAR
To tar a file:
tar -cf nameOfTar.tar Folder1 Folder2
To untar a file
tar -xvf nameOfTar.tar
To untar a gzip file
tar -zxvf nameOfTar.tar.gz
Touch
A simple command that can create a file quickly
touch /var/log/somelogname.log
chmod 700 /var/log/somelogname.log
echo “this is a log file” > /var/log/somelogname.log
cat /var/log/somelogname.log
HTTPD Restart
/etc/init.d/httpd restart
Server Version
cat /etc/redhat*
CentOS release 4.5 (Final)
2)On SUSE Linux,
$cat /etc/SuSE-release
Top
Top displays a lot of system information in real time. CPU/memory/etc. It is a resource hog though.
top
Free Memory
free –m // memory
FTP
ftp server.com
use ftp -i server.com to remove confirmations. For example, downloading multiple files requires the use of mget *.*. Without logging in with -i it will force you to acknowledge the download of each file.
Reboot
shutdown -r now is reboot
Nice
Usage: nice [OPTION] [COMMAND [ARG]...]
Run COMMAND with an adjusted scheduling priority.
With no COMMAND, print the current scheduling priority. ADJUST is 10
by default. Range goes from -20 (highest priority) to 19 (lowest).
-n, --adjustment=ADJUST increment priority by ADJUST first
--help display this help and exit
--version output version information and exit
Example:
cd /; nice -n 15 /usr/bin/clamscan -r | mail -s "Server: AV Scan Results" chad@xxxxxxxxxxxx.com
Display resources
cat /proc/user_beancounters
egrep "failcnt|numiptent" /proc/user_beancounters
httpd configtest
/etc/init.d/httpd configtest
Tuesday, April 13, 2010
Getting Subversion 1.5.7 installed on Cent OS 4.8.
This is for my personal notes as I could not find a repo for yum that had Subversion 1.5.7. RPMForge has 1.4.6 currently for Cent OS 4. Also, this install is on Mediatemple's DV.
Search for current versions
Returns something like the following:
Remove current versions
Get new version and install
Make a hard link to the new location of svn fom our bin directory
Check Version
Search for current versions
rpm -qa | grep -i subversion
Returns something like the following:
subversion-1.4.6-0.2.el4.rf
Remove current versions
rpm -evf mod_dav_svn-1.4.6-0.2.el4.rf
rpm -evf subversion-1.4.6-0.2.el4.rf
Get new version and install
curl -O http://subversion.tigris.org/downloads/subversion-1.5.7.tar.gz
curl -O http://subversion.tigris.org/downloads/subversion-deps-1.5.7.tar.gz
tar xzvf subversion-1.5.7.tar.gz
tar xzvf subversion-deps-1.5.7.tar.gz
cd subversion-1.5.7
./configure --prefix=/usr/local --with-openssl=/usr/bin --with-ssl
make
make install
Make a hard link to the new location of svn fom our bin directory
ln /usr/local/bin/svn /usr/bin/svn
Check Version
[root@yodayoda]# svn --version
svn, version 1.5.7 (r36142)
compiled Apr 13 2010, 14:25:56
Subscribe to:
Posts (Atom)