LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2012, 05:11 AM   #1
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Rep: Reputation: Disabled
help- how to reduce Size of Email attachment send via Crontab


Hi,

Below is my query- I got Mail with attachment for the below Query to my office outlook.when the Attachment size is very less- i get email from Crontab.But when my Attachment size is too long(in my case .xls has 15mb -)so no mail is coming to my outlook-because of size. pls. help me to reduce the size of the email attachment.
--------------------
cd '/home/achakra/Prasanna/Auto'

nohup bteq <xn_sac_wk11.bteq> sac_tire.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas sac_tire.sas
wait

uuencode SAC_Tire.xlsx SAC_Tire.xls > UCD_test.xls

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < UCD_test.xls

----------------------------
Urgent- as i have to send the report ... now.. pls..
 
Old 02-28-2012, 05:19 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Don't demand urgent help. This isn't urgent for us.

I'm not sure what you really expect us to tell you... you need less content. You can compress it, that may well help you, so run it through gzip between the uuencode and the mailx commands.
 
Old 02-28-2012, 05:28 AM   #3
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
[QUOTE=acid_kewpie;4613942]Don't demand urgent help. This isn't urgent for us.

Apologies for that . Thanks for your reply. i am new to this- so to confirm : check my below code is that fine?
-------
uuencode SAC_Tire.xlsx SAC_Tire.xls > UCD_test.xls

gzip

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < UCD_test.xls

----------------
 
Old 02-28-2012, 06:16 AM   #4
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
when i ran the above code(including gzip) - i get Mail - but with no attachment.pls. help
--------------------
cd '/home/achakra/Prasanna/Auto'

nohup bteq <xn_sac_wk11.bteq> sac_tire.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas sac_tire.sas
wait

uuencode SAC_Tire.xlsx SAC_Tire.xls > UCD_test.xls

gzip

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < UCD_test.xls

----------------------------
 
Old 02-28-2012, 06:25 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
you can't just run "gzip"... what do you expect it to do??


uuencode SAC_Tire.xlsx SAC_Tire.xls > UCD_test.xls

gzip UCD_test.xls

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < UCD_test.xls.gz
 
Old 02-28-2012, 11:05 PM   #6
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
hi have executed below code- the attachment is getting zipped in my directory, but i am not receiving any mail,below is my code
-------
cd '/home/achakra/Prasanna/Auto'
nohup bteq <xn_sac_wk11.bteq> sac_tire.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas sac_tire.sas
wait

uuencode SAC_Tire.xls SAC_Tire.xls >UCD_Test.xls

gzip SAC_Tire.xls

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < SAC_Tire.xls.gz
----------------------------------
 
Old 02-28-2012, 11:22 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Check the size of the SAC_Tire.xls.gz file.
You have several options

1. reduce amt of data in each file, even if this means sending multiple files
2. use the gzip compression option -1 to -9 to increase compression efficiency ( -9 is best compression)
http://linux.die.net/man/1/gzip
3. get your email admins to increase your attachment size allowance
4. try http://linux.die.net/man/1/bzip2 as an alternative; it has the same options eg -1 to -9 to increase compression. You may(!) get better compression ... or not ...
 
Old 02-28-2012, 11:26 PM   #8
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
The size of zipped attachment is 700kb- But it has not attached.
will try above options- what you have mentioned. is the above code- correct(whatever i tried to execute)?
 
Old 02-29-2012, 12:08 AM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
try these http://www.unix.com/unix-advanced-ex...ing-mailx.html
 
Old 02-29-2012, 12:09 AM   #10
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
I tried both gzip and bzip -- My email attachment(one file- that has 15mb) is being zipped to 500kb - in my directory as SAC_Tire.xls.gz.But I didn't receive any mail .. not sure where i am making the mistake .. (when i try sending a smaller sized attachment without zipping- i got mail with attachment)
--------------------------
cd '/home/achakra/Prasanna/Auto'

nohup bteq <xn_sac_wk11.bteq> sac_tire.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas sac_tire.sas
wait
uuencode SAC_Tire.xls SAC_Tire.xls >UCD_Test.xls

gzip -9 SAC_Tire.xls

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < SAC_Tire.xls.gz
--------------------------------------------------
there is no error in logfile.?? not sure what is the mistake- can u help on this

Last edited by pnandak; 02-29-2012 at 12:10 AM.
 
Old 02-29-2012, 12:19 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Forget all the other code; just test the mailx line.
Try the example from post #4 in my prev link http://www.unix.com/unix-advanced-ex...ing-mailx.html
 
Old 02-29-2012, 12:40 AM   #12
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
uuencode -m SAC_Tire.xls.gz SAC_Tire.xls.gz | mail -s "SAC Weekly Tire Report" Mailid@yahoo.com

now i get a mail with no attachment- but the Body of the mail has some junk characters written to it-- without subjectline
 
Old 02-29-2012, 02:31 AM   #13
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
Ugh, sorry, of course you wouldn't want to gzip AFTER the uuencode... sorry just about never ever used uuencode.
 
Old 02-29-2012, 02:56 AM   #14
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
now, i am confused??.. pls. validate my code ??
--------
--------------------------
cd '/home/achakra/Prasanna/Auto'

nohup bteq <xn_sac_wk11.bteq> sac_tire.out 2>&1 &
wait

/opt/sas/SAS_9.1/sasexe/sas sac_tire.sas
wait
uuencode SAC_Tire.xls SAC_Tire.xls >UCD_Test.xls

gzip -9 SAC_Tire.xls

mailx -s "SAC Weekly Tire Report" -r "Prasanna" `cat /home/achakra/Prasanna/Auto/mailpcp1.dat` < SAC_Tire.xls.gz
--------------------------------------------------
 
Old 02-29-2012, 03:13 AM   #15
pnandak
LQ Newbie
 
Registered: Feb 2012
Posts: 18

Original Poster
Rep: Reputation: Disabled
i am getting mail- with body of the message - with junck characters like:

begin-base64 644 SAC_Tire.xls.gz
H4sICNHiTU8CA1NBQ19UaXJlLnhscwDsXWlv28iW/e5fwafBPHQDEV37ko4DOFt3gO4k
SNzT8z4FtMTEmpYlP0q24wnmv08VtdjxUkUWxeXKcoAkJimqSB7e5dzt2T9evX959K8P
r6OT+ek4+vDni9/fvox6/f39v+jL/f1XR6+i347++D1iMcLRUZZMZqP5aDpJxvv7r9/1
nu89sx+z/6TJ0Pxzm
;;;
---
---
 
  


Reply


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
PHP: Send email with attachment and UTF8 in filenames Guttorm Programming 6 02-17-2012 04:27 PM
Email Attachment size limit madfed Linux - Server 4 06-21-2009 03:45 AM
How to send a html file as an file attachment to my mail from crontab? GRD Linux - Newbie 2 06-03-2008 11:39 AM
Script run by crontab won't send email Braynid Linux - Newbie 1 12-21-2007 12:16 AM
Send Email + Txt Attachment Using Cron Job beringer Linux - Newbie 3 01-31-2003 10:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:59 AM.

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