I am writing some backup scripts for a server, and I needed a way to let the root user on the machine to login to PostgreSQL as 'postgres' user to perform some administrative operations.
To do so, I had to make a few changes to the configuration file, to let the root user to authenticate via local-socket without providing a password (the script is launched automatically by cron, no user interaction needed).
/etc/postgresql/8.3/main/pg_hba.conf
1 2 |
# TYPE DATABASE USER CIDR-ADDRESS METHOD local all postgres ident rootaspg |
![]()
..quante volte capita di dover usare pg_dump e pg_restore per operazioni sui database postgres ma non ricordarsi la sintassi e doverla andare a cercare?
Ecco qua un paio di scriptini php per creare automaticamente i comandi da eseguire..
In funzione qui: http://stuff.hackzine.org/utils/pgcommands/
Codice su svn: http://svn.hackzine.org/misc/utils/pgcommands/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #!/usr/bin/env python """ MySQL Database Backupper Copyright (C) 2008 Samuele ~redShadow~ Santi - http://hackzine.org This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |