Woot!
# lsof | grep access_log
apache2 1649 root 8w REG 8,1 0 4334715 /var/log/apache2/access_log (deleted)
apache2 15265 www-data 8w REG 8,1 0 4334715 /var/log/apache2/access_log (deleted)
apache2 15266 www-data 8w REG 8,1 0 4334715 /var/log/apache2/access_log (deleted)
# cd /proc/1649/fd
# ls -alh
total 0
dr-x------ 2 root root 0 2009-11-17 18:31 .
dr-xr-xr-x 7 root root 0 2009-11-17 16:15 ..
lr-x------ 1 root root 64 2009-11-17 18:32 0 -> /dev/null
l-wx------ 1 root root 64 2009-11-17 18:32 1 -> /dev/null
l-wx------ 1 root root 64 2009-11-17 18:32 2 -> /var/log/apache2/error_log
lrwx------ 1 root root 64 2009-11-17 18:32 3 -> socket:[5823]
lrwx------ 1 root root 64 2009-11-17 18:32 4 -> socket:[5824]
lr-x------ 1 root root 64 2009-11-17 18:32 5 -> pipe:[576841]
l-wx------ 1 root root 64 2009-11-17 18:32 6 -> pipe:[576841]
l-wx------ 1 root root 64 2009-11-17 18:32 8 -> /var/log/apache2/access_log (deleted)
# cat 8 > /var/log/apache2/access_log && /etc/init.d/apache2 stop && /etc/init.d/apache2 start
Tuesday, November 17, 2009
Restoring a file that still has an open filehandle on Linux
My rm /var/log/access_log* was a little greedier than I wanted it to be. What I meant to use was rm /var/log/access_log.* :-( . Never fear, apache didn't know I had deleted the file as it had an open filehandle and was happily logging away, but how to restore it? Check out the step by step:
Monday, October 12, 2009
Making sure PTR records and A records match
DNS is so simple! Unfortunately it seems like it's simple to screw up also, here's a little script I wrote the other day to verify that all my reverse dns was setup correctly. I've written this script before at least twice, so I thought I would post it. Just feed it a CIDR range via command line and it will check all those ips. Like this:
# perl ptrchecker.pl 192.168.0.0/24
#!/usr/bin/perl
use NetAddr::IP;
use Socket;
use strict;
foreach my $cidr(@ARGV) {
my $n = NetAddr::IP->new( $cidr );
for my $ip( @{$n->hostenumref} ) {
next if ($ip->addr() =~ /\.[0|1|2]5?5?$/);
my ($name,$aliases,$addrtype,$length,@addrs) = gethostbyaddr($ip->aton(), AF_INET);
my $addr = join ".", unpack('C4', (gethostbyname $name)[4]);
print "busted ip: " . $ip->addr() . " PTR is $name, A is $addr\n" if ($ip->addr() ne $addr);
#select(undef, undef, undef, 0.05);
}
}
Thursday, October 8, 2009
Installing smartear on Ubuntu Jaunty
First apt-get remove pidgin. Don't do any autoremoving, you might need some of those devel packages later on. Next, hop on over to pidgin's and smartear's sites and download source tarballs.
Extract both tarballs, you will then need to compile pidgin from source. I did have to disable video and voice capabilites, that's fine for me. But if you want them you will need to find the correct libraries.
Now it's time to get into that SmartEar tarball. If you check out the INSTALL file you will see that you need to edit the Makefile and change the PIDGIN_SRCDIR to whatever directory you compiled pidgin in. So:
Then just run make install:
Done!
Extract both tarballs, you will then need to compile pidgin from source. I did have to disable video and voice capabilites, that's fine for me. But if you want them you will need to find the correct libraries.
# apt-get -y remove pidgin
# apt-get -y build-dep pidgin
# ./configure --disable-vv
# make install
Now it's time to get into that SmartEar tarball. If you check out the INSTALL file you will see that you need to edit the Makefile and change the PIDGIN_SRCDIR to whatever directory you compiled pidgin in. So:
PIDGIN_SRCDIR=../whatever_directory_you_untared_to/pidgin
Then just run make install:
# make install
Done!
Subscribe to:
Comments (Atom)