New Perspectives On Web Design

(C. Jardin) #1
By Paul Tero CHAPTER 8

less is powerful. You can press arrow keys or j to go down, k to go up,
/something to search for “something” and h to see a helpful list of all the
commands. If you can narrow down the moment of failure of your Web
server to a few hours, you can use less to navigate to that part of the log
file.


SYSTeM logS


There are several other useful log files in /var/log such as syslog (the
system logger) and dmesg (bootup messages). They all use a similar date
format so if you can narrow down the time when you suspect something
went wrong, you can search them all at once. This command changes to
the /var/log directory and then outputs all the files using zcat -f. The
[234] in grep is borrowed from regular expressions and matches the
numbers 2 or 3 or 4. So this will display any error messages in any of the
logs that took place on May 5 between 02:00 and 04:00 in the morning:


$ cd /var/log; zcat -f * | grep "May 5 0[234]:" | less


ouT of SPaCe
If your Web server software still won’t start and the error remains elusive,
there are a couple common problems you can explicitly check for. Your
server could have run out of hard drive space. Use the command df to
show disk file usage. The -h shows things in human-friendly form (with M
for megabyte and G for gigabyte instead of really big numbers):


$ df -h
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/simfs 20.4G 9.8G 10.6G 49% /
tmpfs 1.6G 0 1.6G 0% /lib/init/rw
tmpfs 1.6G 0 1.6G 0% /dev/shm

Free download pdf