?
Solved

Either split tar file or increase max attachment size for Rmail

Posted on 2010-01-05
11
Medium Priority
?
302 Views
Last Modified: 2013-12-17
I have a backup script written in php. It uses tar commands to back up an entire domain then Rmail to send the file to a single email account for storage.

Everything works correctly if I test with just a single directory, but doesn't email when tarring the entire domain. This leads me to believe that the sendmail has a limitation on the attachment size. I haven't found any way to set this size in the Rmail script (unless I'm just over-looking it.)

I don't have the access needed to edit the sendmail.cf suggested in other solutions I found and this same thing will be done on a couple dozen domains scattered on different hosts.

Anyone have any suggestions on either breaking the tar into smaller files or a way to increase the attachment size allowed through Rmail? I'll include the rmail.php file here in case it helps.
And the code attached is what tars the domain files from a backup directory.
system("tar cvf $filepath ../");

Open in new window

Rmail.txt
0
Comment
Question by:Dzynit
  • 6
  • 5
11 Comments
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 26182398
Try the split command to create 10m files:
 

system("tar cvf - ../|split -b 10m - $filepath");

Open in new window

0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 26182414
Or maybe you could "zip" it:
system("tar cvf - ../|gzip -c >${filepath}.gz");

Open in new window

0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 26182430
PS: The tar command also has a complression option:
man tar
 
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 14

Author Comment

by:Dzynit
ID: 26182494
Is there a way to split it when zipping it?

I had problems earlier on running the gzip command at the same time for some reason so I was tarring first then gzipping it, but splitting the tar then gzipping makes it a little tougher since the splits have different names on the end.

Unless you could suggest how to get the list of split files to gzip second.

0
 
LVL 14

Author Comment

by:Dzynit
ID: 26182545
Does this seem correct to you for both splitting and gzipping at the same time?

(I added .gz to the end of the $filepath variable.)

system("tar -zcvf - ../|split -b 10m - $filepath");

Open in new window

0
 
LVL 14

Author Comment

by:Dzynit
ID: 26182950
How do you rejoin the split files?
0
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 26183259
To re-join:
 

cat $filepath*>${filepath}.full

Open in new window

0
 
LVL 14

Author Comment

by:Dzynit
ID: 26183382
I found and tried that. The file won't open for my using 7-zip after re-joining it, but I'm trying to upload it to a test area and try unarchiving it with tar to see if works correctly that way.

The one piece that I didn't use is the asterisk. Does that have special meaning?

Meanwhile, my file is uploading really slow right now. Might be a few minutes yet till I can confirm that it un-archives right.
0
 
LVL 14

Author Comment

by:Dzynit
ID: 26183415
I tried using the following code, but it didn't unarchive.

system("tar -xzf $file");

Open in new window

0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 2000 total points
ID: 26184758
Do "man tar", some *nix flavours use capital Z.
I prefer to use gzip to compress, the command is a bit longer:
 
 
 

system("tar cf - ../|gzip -c |split -b 10m - ${filepath}.gz");

Open in new window

0
 
LVL 14

Author Comment

by:Dzynit
ID: 26185781
One more question if you will please. What's the correct syntax for un-archiving the split gzip files?
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Steps to fix “Unable to mount database. (hr=0x80004005, ec=1108)”.
Phishing emails are a popular malware delivery vehicle for attack.  While there are many ways for an attacker to increase the chances of success for their phishing emails, one of the most effective methods involves spoofing the message to appear to …
The viewer will learn how to count occurrences of each item in an array.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question