Remote server rsync question

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,725
28
328
LA, Costa RIca
cPanel Access Level
Root Administrator
Twitter
Currently we rsync our servers to remote back ups servers.

But to save lots of time we are considering not backing email.

We use the "exclude" file for rsync but can't seem to find the right list of things to exclude to not back up emails.

For example this would be a email file we would like to exclude:

daily/username/homedir/mail/new/1220138292.H893460P21474.dwhs38.dwhs.net

My best guess was:

daily/*/homedir/mail/new/*

To block this file from being rsynced.

But no luck

Thanks!
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
42
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Could you provide the actual rsync command? The path for the rsync determines the relative local path. You haven't provided sufficient information on what command is being used for the rsync to know what the relative path would be.

Also, mail is normally at /home/username/mail/ location, so this would be /home/*/mail/* but if you are rsyncing starting with home, it may be the following:

*/mail/*
 

WebHostPro

Well-Known Member
PartnerNOC
Jul 28, 2002
1,725
28
328
LA, Costa RIca
cPanel Access Level
Root Administrator
Twitter
Sure:

rsync --delete -vae ssh 66.123.123.12:/backup/cpbackup/daily /home/hostname/ --exclude '/root/exclude.txt'

Then in the exclude file I have

daily/username/homedir/mail/new/1220138292.H893460P21474.dwhs38.dwhs.net

--

I want to prevent all files for all users in the mail/new folder from being copied.

Thanks again!
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
42
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Sure:

rsync --delete -vae ssh 66.123.123.12:/backup/cpbackup/daily /home/hostname/ --exclude '/root/exclude.txt'

Then in the exclude file I have

daily/username/homedir/mail/new/1220138292.H893460P21474.dwhs38.dwhs.net

--

I want to prevent all files for all users in the mail/new folder from being copied.

Thanks again!
This is the issue, you are starting in /backup/cpbackup/daily and putting daily as the beginning location in the exclude file. You need to remove daily, so it should be:

*/homedir/mail/*