On Saturday 29 November 2008, Andrus wrote: > How to create automated backup script in Gentoo which in every night 3:00 > PM backups one database and sends backup > with ftp using unique file name? > > In windows I can use scheduler and script > > set FILENAME=%DATE:~8,4%%DATE:~5,2%%DATE:~2,2%MyDbBackup > pg_dump -Z6 -b -v -f "%FILENAME%.backup" -F c -h localhost -U postgres mydb > ftp -send -u username -p password "%FILENAME%.backup" > ftp.backupserver.com Write a shell script that you store someplace you know (i.e. your database users home directory) say you name it: /home/whoever/mybackup.sh #!/bin/sh cd /someplace/to/store/backups pg_dump -Fc -R -O -i -Upostgres mydb > mydb_backup`date +'%Y%m%d'`.sql [FTP STUFF GOES HERE - see below] save the file. Do a "chmod 755 /home/whoever/mybackup.sh" type "crontab -e" being logged in as the user who should run this script ("whoever" in the example above) In the edior add a line like 0 3 * * * /home/whoever/mybackup.sh save. Now you'd just have to figure out the ftp part, because I use rdist to push the copies to a backup machine. HTH Uwe -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general