Command-line utilities |
---|
restartit - Process watching script, will restart any services you configure the script to watch should they die unexpectedly, meant to be run from crontab. Configuration should be self-explanatory and is all done in the top section of the script. |
check-mysql-db-table - Script will check a table in a specific database and repair it using the REPAIR MySQL SQL syntax. Install in /usr/local/bin. Note: the script expects to login as root using a stored root password in ~root/.my.cnf, so run it as root. |
check-mysql-db -
Script will check all tables in a MySQL database and repair any that
are corrupt using the REPAIR MySQL SQL syntax. Results from the
repair attempt will be stored in /var/log/db-logs/#db-name#-check.log
unless you pass an argument to the script after the name of the
database, e.g.
check-mysql-db eximstats 1in which case results will be logged to STDOUT. This script calls check-mysql-db-table (above), so make sure to install that script first. Install both in /usr/local/bin. |
vps-firewall - This shell script takes care of setting up a firewall for a Virtuosso based Linux VPS (no stateful rules/connection tracking or logging because the iptables modules for those functions are not available). Borrows heavily from a script by Dmitry Konstantinov of sw-soft. Install in /etc/init.d. After installing the file in /etc/init.d, run/sbin/chkconfig --level 345 vps-firewall onto have the firewall started when the host goes into multi-user mode. |
procs-by-user - Shows numbers of processes running by user, sorted by number running, highest to lowest. U seful for troubleshooting. |
procs-by-proc - Shows number of processes running by process name, sorted by number running, highest to lowest. Useful for troubleshooting. |
conns-by-port - Shows remotely connected
clients by protocol (listening socket is 0.0.0.0).
bash$ conns-by-port --help /usr/local/bin/conns-by-port [--resolve|-r] [--top|-t N] port1 ... portNFor example, to see all clients connected to your host that are using SMTP or SMTP/SSL, you could do: bash$ conns-by-port 25 465 ================================================ Port 25 ( smtp ) ================================================ 1 88.226.3.9 1 88.226.228.42 1 70.88.245.54 1 68.118.250.252 1 67.168.96.142 1 64.235.57.241 1 41.205.112.113 1 208.107.13.16 1 200.233.210.94 1 158.75.205.18 1 0.0.0.0 ================================================ Port 465 ( smtps ) ================================================ 1 0.0.0.0See the top 10 list of clients with the most HTTP connections, with host names resolved: bash$ conns-by-port --top 10 --resolve 80 ================================================ Port 80 ( http ) ================================================ 4 crawl-66-249-65-138.googlebot.com 2 wj500026.inktomisearch.com 2 livebot-65-55-209-164.search.live.com 2 g10.fatlens.com 2 crw51.vc.search.re4.yahoo.com 1 wj500025.inktomisearch.com 1 ool-45733331.dyn.optonline.net 1 livebot-65-55-208-58.search.live.com 1 d54C3870C.access.telenet.be 1 crawl-66-249-72-176.googlebot.com |
conn-info - Shows TCP connection information for
a server, including states, inbound and outbound connections by port,
and in/out connections by address, all sorted highest to lowest.
bash$ conn-info Connections by state TIME_WAIT 70 FIN_WAIT2 9 ESTABLISHED 8 CLOSE_WAIT 8 SYN_SENT 1 FIN_WAIT1 1 Connections inbound by port (exl 127.0.0.1) 25 17 80 15 22 1 Connections outbound by port (exl 127.0.0.1) 25 5 5859 1 Connections inbound by client addr (> 5) (exl 127.0.0.1) 201.50.121.166 9 Connections outbound by server addr (> 5) (exl 127.0.0.1) 10.41.22.58 15 10.41.22.14 10 If you see a high number of FIN_WAIT1 or FIN_WAIT2 states relative to other TCP connection states there is an issue to investigate as connections are not being closed properly (I have seen this happen with misconfigured Spam Assassin installations several times). If you see a high, consistent number of SYN_SENT or SYN_RECEIVED you might either be under (RECEIVED) or something on your server is creating ;p (SENT) a SYN flood. TIME_WAIT is a normal part of closing a socket connection, you will most likely see a relatively high number of your connections in this state if you run a web server. |