RES: Shell Script help for backup
От | Elielson Fontanezi |
---|---|
Тема | RES: Shell Script help for backup |
Дата | |
Msg-id | A799F7647794D311924A005004ACEA97080DDE63@cprodamibs249.prodam обсуждение исходный текст |
Список | pgsql-general |
Hi! I am so interested in your working on this! I've just do some shell scripts to do backup and restore. May be we can talk a little more. About FTP'ing files. I can tell you that if you transfer backup file which was dumped with -Fc option, it gets corrupted just after the transfer. I suggest that you use ascii format (-Fp) or tar format (-Ft). Do you wanna see may shell scripts? About your question, I need to find a way to fail the pg_dump file. In what way? That is a good question. I'll think on it. -----Mensagem original----- De: ratlhead@ratlhead.com [mailto:ratlhead@ratlhead.com] Enviada em: sábado, 20 de julho de 2002 06:26 Para: pgsql-general@postgresql.org Assunto: [GENERAL] Shell Script help for backup Hey all, I'm thinkin' maybe I should post this in a shell scripting group but thought someone here may be able to help me out... I'm lookin' to run a shell script through the crontab on a nightly basis for backup, and not keep more than a week of backups. In those terms, I have a script working. But I wanna take the script to another level. Basically, I want it to email me if pg_dump fails, but I'm having a hard time doing so. here's what I got #!/bin/bash DATE=`date +%Y-%m-%d` PGUSER=<my username> PGPASSWORD=<my password> export PGUSER PGPASSWORD pg_dump <dbname> | gzip > /folder/pg_backup.$DATE.gzip if [ !$? ] then find /folder/pg_backup/* -mtime 8 -exec rm -f {} \; echo "The PostGreSQL backup for today completed successfully" | mail ratlhead@ratlhead.com else echo "The PostGreSQL backup for today was unsuccessful" | mail ratlhead@ratlhead.com fi The problem is that is always gets detected as being successful, even if I say, comment out the export line of my user/pass. Any suggestions on how I can detect whether or not it worked? Something else I'll be lookin' to do is FTP'ing the backup to another server. If anyone has suggestions on where I can look for help on that, it'd be great. Thanks! ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
В списке pgsql-general по дате отправления: