diff --git a/README.md b/README.md index da4ab86..c2fdf86 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ The DBD::Pg Perl module must be installed for these scripts to work. This can b perl -MCPAN -e "CPAN::Shell->force(qw(install DBD::Pg));" ``` +You may be asked by CPAN for the path to `pg_config`. You must provide the path, usually it is something like `/usr/pgsql-9.2/bin/pg_config`. If you do not have the pg_config binary, you will probably need to install the postgresql devel package. + ### ### # Installation # ### ### diff --git a/script/funcs.pl b/script/funcs.pl index ac3b0f0..321b209 100644 --- a/script/funcs.pl +++ b/script/funcs.pl @@ -277,7 +277,12 @@ sub backup_database{ sub vacuum{ unless($skip_vacuum){ echo("vacuumdb started..."); - cmd("vacuumdb -a -z -U $db_user 2>&1"); + + my $vac_cmd = "vacuumdb -a -z"; + + my $cmd = "test `whoami` == '$db_user' && $vac_cmd 2>&1 || su $db_user -c \"$vac_cmd\" 2>&1"; + + cmd($cmd); echo("vacuumdb finished."); }else{ echo("Skipping vacuumdb...");