Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 10-18-2004, 11:35 PM   #1
LQ Newbie
Registered: Aug 2002
Location: Slackware, KS
Distribution: Slackware
Posts: 12

Rep: Reputation: 0
automate database backup

I have a postgresql database that I would like to have backed up daily to a windows box. I do not want to use samba by any means.

I would like to use pg_dump to back up the database to a file. Once the file is created I would like it to be copied over to a windows box or linux machine.

I have been looking at "AT" and "CRON" to schedule pg_dump to backup the database

After the database is tranfered to a file on the linux side I would like it to be copied over to a windows box or another linux machine.

If a simple shell script would do the trick please advise

Please I need some help bad!
Old 10-19-2004, 04:19 AM   #2
Senior Member
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
umount /mnt/2k 2>/dev/null 1>/dev/null
mount -t smbfs //winbox_name/share /mnt/2k/ -o username=administrator,password=pass
if [ ! -d /mnt/2k/backup ] ; then
echo " cannot erach the backup dir on network drive" >/root/script-logs
echo " directory might be deleted or cannot mount network drive" >>/root/yedek-scripts/script-logs
umount /mnt/2k 2>/dev/null 1>/dev/null
exit 0
DATE=$(date +%d.%m.%Y-%H.%M)
echo "DATE:$DATE">>/root/script-logs
echo "-------------------------------------------------------------">>/root/script-logs
cp -R /path/to/backup/* /mnt/2k/backup 1>>/root/script-logs 2>>/root/script-logs 
umount /mnt/2k 1>>/root/script-logs 2>>/root/script-logs
this is very simple script. because it just copies files to windows share. u will probably want to delete older files keeping last 7 one or more and compress the files to save the disk space. if u want let me know pls

u can use cron to shedule the task. the following example will run /root/script file at 00:20 everyday:
#crontab -e
20 00 * * * /root/

good luck


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLite database backup ddpicard Linux - Software 2 11-01-2004 07:54 PM
Automating a full database backup dominant Linux - Newbie 2 07-10-2004 08:59 AM
How would I automate this? onewhoknows Linux - Newbie 5 06-22-2004 05:49 AM
Need script to dump database, ftp file to backup server glock19 Linux - Networking 17 05-12-2003 06:56 PM
Had to restore database from backup - about 5 minutes lost jeremy LQ Suggestions & Feedback 0 01-21-2001 11:31 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:29 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration