Using rsync to sync two folders across a network

I'm running a Xen-node as a test, in addition to my linode.

Is there an easy way to sync-up the /web (where my wwwdata is kept) folders in there? I was thinking rsync, but any type of automated solution would be good.

The only real issue I can think of is that i have a few symbolic links in there, in order to make it easy for someone to keep webspace in their home folder.

Also, what's the command to setup a cron to backup the DB daily, bzip2 it, and name it "dbbackup4-21.bz2, dbbackup4-22.bz2" etc etc etc.

Thanks :)

Jay

1 Reply

You can look up the options for what to do with symlinks in the rsync man page. As for you backups, you can write a script along these lines and cron it:

DESTDIR=/backup/root/`date "+%Y-%m"`
FILENAME=dbbackup-`date "+%Y-%m-%d-%H%M"`.tgz

mkdir -p ${DESTDIR}
tar -C ${SRCROOTDIR} -czpf ${DESTDIR}/${FILENAME} ${SRCDIR}

You can do the necessary changes for bzip compression instead of gzip, but that should get you going.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct