This displays the number of open connections to port 80 on a server, dumping the ip address/connection count pairs in ascending order.
netstat -anlp | grep :80 | awk '{print $5}' | awk -F: '{print $1}' | sort | uniq -c | sort -n
This can be useful in combination with grep1 searches performed on
httpd fullstatus
to determine if a DOS attack is being performed on a server.
When recompiling SVN 1.5.5 from source, making sure to include the swig-py bindings to allow Trac to read from local SVN repositories, I used the following ./configure command
./configure --prefix=/usr/local/svn-1.5.5/ --with-apr=/usr/local/apr/bin --with-apr-util=/usr/local/apr/bin --with-neon=/usr/bin --with-apxs=/usr/local/apache/bin/apxs
When trying to view my repository I was presented with the following error in my trac.log file
SubversionException: ("Can't set position pointer in file '/var/svn/db/revs/135': Invalid argument", 22)
After some research1 I found the most common cause of this error is that Subversion was compiled against a different version of apr and apr-util than apache was. I found apache compiled with cPanel’s EA3 uses
/usr/local/apache/bin
as it’s path for apr and apr-util. Changing the flags to reflect this when compiling Subversion I was left with
./configure --prefix=/usr/local/svn-1.5.5 --with-apr=/usr/local/apache/bin --with-apr-util=/usr/local/apache/bin --with-neon=/usr/bin --with-apxs=/usr/local/apache/bin/apxs
make swig-py
make install
make install-swig-py
cd /usr/local/svn-1.5.5/lib/svn-python/
cp -r libsvn/* /usr/lib/python2.4/site-packages/libsvn
cp -r svn/* /usr/lib/python2.4/site-packages/svn
service httpd restart
I also ran the following out of habit after recompiling SVN before restarting httpd.
trac-admin TRAC_ENV_PATH resync
Restarting httpd while trying to alleviate high load on one of the servers I manage, I was recently presented with the following error
(28)No space left on device: Couldn't create accept lock
After some research I found running the following command1
ipcs -s
showed there were a bunch of semaphores hanging around even though apache had been stopped normally via
service httpd restart
Similar to the code snippet mentioned by Major over at RackerHacker, the following command clears out those semaphores, letting httpd start up without a problem
ipcs -s | grep nobody | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'