X-Git-Url: https://piware.de/gitweb/?p=bin.git;a=blobdiff_plain;f=cleanpg;h=3719c345cc14657c43852ce6524d71e4d7043451;hp=5bd6e0f0a122abd0d34510001648d487b476805f;hb=fc2c95cf8faf90b6e22bd1358753c85b1d790a7c;hpb=c22bcf5b85e658d40a834a5bfd0db92cba06da9f diff --git a/cleanpg b/cleanpg index 5bd6e0f..3719c34 100755 --- a/cleanpg +++ b/cleanpg @@ -1,7 +1,8 @@ #!/bin/sh -sudo /etc/init.d/postgresql-7.4 stop -sudo /etc/init.d/postgresql-8.0 stop -sudo /etc/init.d/postgresql-8.1 stop -sudo /etc/init.d/postgresql-8.2 stop -sudo killall pg_autovacuum postmaster postgres -sudo rm -rf /etc/postgresql /var/lib/postgresql/ /var/log/postgresql/ /tmp/postgresql-testsuite/ /var/run/postgresql/* +[ `id -u` = 0 ] || SUDO=sudo +for v in 7.4 8.0 8.1 8.2 8.3; do + i=/etc/init.d/postgresql-$v + [ -x $i ] && $SUDO $i stop +done +$SUDO killall pg_autovacuum postmaster postgres +$SUDO rm -rf /etc/postgresql /var/lib/postgresql/ /var/log/postgresql/* /tmp/postgresql-testsuite/ /var/run/postgresql/*