Linux.com

oh . . . the terror . . .

Posted by: Anonymous Coward on March 01, 2007 11:34 PM
Last monday I made a complete fool of myself by making tiny typing mistake as root. The consequence was that all the vhost configuration files vanished from the server (for about 50 sites with lots of aliases). Apache was still running though.

This meant that after some sweaty moments googling for a solution. I found one that explained how to restore the complete vhost configuration from the memory of the running apache process:
- ps ax --forest| grep apache2 # get the pid of the parent process
- gdb apache2 [found pid] # hook onto the running apache process
- gcore # dump a core file
- quit # quit gdb
- strings [the core file] > saved.txt

Saved.txt will contain the vhost configuration, mostly intact, some bits slightly garbled.

But boy was I happy!

The backup scripts have been fixed to include the vhost files. The author of the backup scripts has been dragged naked around the block behind a bike.

#

Return to CLI Magic: Linux troubleshooting tools 101