LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-26-2012, 12:39 AM   #1
rruchika
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Rep: Reputation: Disabled
Email Attachment not working with crontab


I am using below command to send email with attachment

uuencode mount.html mount.html| mailx -s 'Mountpoint Report' abc@xyz.com

It's working fine if i am executing thru command line but with cronjob it's not working. I mean it's sending email but without attachment..

Any clues??
 
Old 03-26-2012, 02:49 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
showing us the full crontab entry would be a start. Cron is usually a good place to always use absolute paths to binaries, to remove any presumptions about environmental path values etc. Also loosks like it *might* be a good candidate to just drop a standard script file into a directory like /etc/cron.daily rather than directly messing with crontab lines.
 
Old 03-26-2012, 03:27 AM   #3
rruchika
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Cronjob Entry

00 08 * * * sh /appl/mediation/comptel/convmed/utils/envteam/email1.sh >/appl/mediation/comptel/convmed/utils/envteam/email1.log
 
Old 03-26-2012, 06:14 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Possibly because the script doesn't have a full path to uuencode and PATH does not include the directory it is in when run under cron.

The easiest solution might be to set-and-export the PATH that your script relies on in the script itself.
 
Old 03-26-2012, 06:18 AM   #5
rruchika
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thumbs up got answer

Its working now...

I just added the absolute path of mount.html

uuencode <absolute path >mount.html mount.html| mailx -s 'Mountpoint Report' abc@xyz.com

Thanks all for ur suggestions..
 
  


Reply



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
help- how to reduce Size of Email attachment send via Crontab pnandak Linux - Newbie 18 02-29-2012 06:12 PM
problem in adding attachment in crontab kalpesh chhajed Linux - Newbie 3 11-25-2011 04:51 AM
convert email files with attachment to save as attachment file (metamail?) ted_chou12 Linux - Software 2 04-08-2011 08:01 PM
email attachment lhrt Linux - Networking 3 05-31-2006 05:13 AM
cannot receive email with attachment charles168 Linux - Software 2 09-06-2003 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:14 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
Open Source Consulting | Domain Registration