Fri, 29 Dec 2006

Network Troubleshooting Article

It's been a while since I last wrote an article, but I've just published a new one on troubleshooting networking. It's based on a couple of emails I sent to a mailing list helping someone with their networking problem. I decided to clean it up a bit and publish it. It is mostly for finding where the problem lies, rather than fixing the issue, but I would be grateful for any comments you have, particularly if you think I've missed any obvious steps.

[article,network troubleshooting,linux] | # Read Comments (2) |

Comments

Wed, 20 Dec 2006

Tomcat boggle

mojo-jojo david% ant clean
Buildfile: build.xml

clean:
     [echo] Deleting all project files
   [delete] Deleting directory /home/david/tomcat5.5-5.5.20/servletapi
   [delete] Deleting directory /home/david/tomcat5.5-5.5.20/container
   [delete] Deleting directory /home/david/tomcat5.5-5.5.20/jasper
   [delete] Deleting directory /home/david/tomcat5.5-5.5.20/connectors
   [delete] Deleting directory /home/david/tomcat5.5-5.5.20/build

BUILD SUCCESSFUL
Total time: 46 seconds
mojo-jojo david% ls
build.xml  debian/
mojo-jojo david% 

*blink*

[tomcat,wtf] | # Read Comments (0) |

Comments

Tue, 19 Dec 2006

Backing up PostgreSQL

I decided it was probably time that I started backing up my PostgreSQL databases and ended up writing a quick script to do just that. I did have a look at pg_dumpall, but it appears to only write to stdout, meaning I couldn't have a file per database like I wanted.

#!/bin/bash

set -u
set -e

dumpdir=/var/backups/postgresql 

date=$(date +"%Y-%m-%d")
mkdir -p $dumpdir
find $dumpdir -name "*.sql" -mtime +10 -exec rm {} \; 
for database in $(su - postgres -c "psql -l -t" | cut -d'|' -f 1 | grep -v template0); 
do 
        su - postgres -c "pg_dump $database" > $dumpdir/$database-$date.sql; 
done

su - postgres -c "pg_dumpall -g" > $dumpdir/global-$date.sql

Just stick that in /etc/cron.daily/postgresql-backups and you should end up with 10 days worth of backups. I'm not sure if postgreSQL can have spaces in database names. I'm assuming it can't. The only other issue to deal with is not storing it on the same machine as the database server, let alone on the same physical hardware or even worse, the same partition.

Update: Corrected typo and added dumping global objects to the script.

Sorry to anyone that got spammed by my change to pyblosxom earlier today. I changed the base url, which changed the link of the entries. I should sort out having proper guids.

[database,PostgreSQL,backups] | # Read Comments (2) |

Comments