General :: Cron Job Email - Log Report Attached Instead Of Being Sent Inline
Sep 20, 2010
I am running a Cron job which mails the content of a log report every day. The problem is that the contents are sent as an attachment instead of as the body of the email. The strange thing is that if I run the instructions from the command line everything works fine, but if I do so from the Cron job the log report is attached instead of being sent inline.
The instruction I use is:
Code:
mail -s "logfile for cron" cron@example.com </var/log/cron-log
Following some advice I read on a blog I also tried this instruction in my Cron file, but the result is the same: it works fine from the command line, but attaches the report when run from Cron:
Code:
echo "Content-Type: text/plain;" | mail -s "logfile for cron" cron@example.com </var/log/cron-log
How to ensure the content of the log file is inline?
Using CentOS. I have a cron setup to run this command: Code: /var/test.sh | mail -s "Test Cron" mr182@somewhere.com The email is sent but the output of the script is not in the email body, it's just blank. I know there is some output because there are some echo statements in the script.I don't want to get an email for all cronjobs, just this one.
I have some scripts that do usual stuff like backing up MySql database, gz, tar some files and put them on FTP or sync with some other backup/mirror system. Some scripts are running quite frequently (like twice/thrice per hour). I am sending email with attached log output from commands after completion of job. It is quite a lot of email to keep track of.I want to send email only when script fails to do something, that is when some command in script fails. How can I accomplish this?
A user will be ftping some files to an upload directory. I need to move those files to another directory. I also need to mail a list of the just moved files to the user. This job will need to run every 10 minutes. I need to keep a log that holds all the files for the day that were moved, renaming it with the date/timestamp.I have this below but I just can't put it all together. a workable script out of this?
I have installed CPAN module Spreadsheet::WriteExcel, to generate some reports. Now when i execute my perl module from command line. it works fine and generates the excel file. When i put this module to be executed via cron, it doenst work and an email is generated. My entry in cron tab is as follows:2 14 * * * perl /scripts/postpaidRecon/postpaid.plThe email i receive in /var/spool/mail/root for module failure is:
My Slackware 13.0 system says it does not know what to use to open a .jpg file. I checked a couple of other threads which say one is supposed to use gimp but that it does not work. What does work?
I have tried the MAILTO="" and adding >/dev/null 2>&1 to the end of the line, but my server is still sending an email about my cron.weekly script. After making changes to /etc/crontab I restart cron with /etc/init.d/cron restart without error. I have also tried crontab -e but that loads up an empty file (su'ed into root). What step am I missing / what am I doing wrong? Here's my crontab:
In my Windows environment, I use email client such as Microsoft Outlook to connect to our email server to send email with the following configuration:
Incoming server (POP3): 995 - (requires with SSL) Outgoing server (SMTP): 465 - (use encrypted connection SSL)
[code]....
And the mail server requires user ID login and password.how do I setup a text command based email client in my Linux (Centos 5.1) to send out email through the existing email server above, which is in another machine? The email client has to be text command based because I need to use command line to send notification email from anothar application installed in my Linux (Centos 5.1) Since the email client will only be used to send email notification, I don't require setting up of an email server in my linux.
I have an email setup where all of the emails from our email host is downloaded to our Linux server using Fetchmail. Then some of the incoming emails are sent to an MS exchange server (server1.domain.com) using Postfix. What i want to do is to send a copy of all emails to Another server (server2.domain.com) for redundancy.Can postfix be configured to send copies out to both?
I am running opensuse11.4. When trying to forward emails I can only do so as attachment. When I click and hold to select the forward inline option I get an empty email - same as if I would have clicked new. The same happens when I place the inline button on to the toolbar. Is this a bug with Kmail or is there another setting to forward mail inline?
I can insert an image inline with mutt by using attach, then using ctl+d to make the image appear inline. However, it appears below my signature. If anyone knows of a way to make the image appear above the signature, I'd be grateful for their input. (This is with mutt 1.5.21--usually sent from a Fedora 14 machine, but I haven't found the behavior to change with the platform.)
Unfortunately, it's necessary to do this at work, for a particular daily email. The workaround is to use Thunderbird for this particular email, but I'd much prefer to use mutt.
It's good that GCC support intel inline disassembly syntax, but it cannot even simply address local variables/parameters properly, making itself stupid and essentially useless, look at the following:
int myfunc(float f){ int x; float fa[8]; asm(".intel_syntax noprefix " "mov eax, [x]
I successfuly installed CentOS to my Dell laptop using CentOS_5.5_Live_DVD.iso and mounting it to a USB flash drive with iso2usb.exe, Now my laptop will Not load CentOS when I remove the USB flash drive, I get a messege saying "no system found".
I am using awstats for my website report . but last 3 days i am not using awstats . now i check awstats,, when i give updatenow then it only shows todays report , we cant find last 3 days report.
I have apt-mirror working perfectly for my local repo.I have it sending me an email everyday after it runs.However, there is nothing in the email. I'd like for the email to show me how much data was downloaded, number of files, (the normal apt-mirror information when ran from terminal). Lastly, the clean.sh script contains nothing to do. What can I add to the script to clean up my repo (remove older packages, etc..) My repo keeps getting larger and larger. It's at 66.7GB now.
I have collected the sa* and sar* files for the past two weeks , i need to generate the report for these files how can i do so i am using centos 5.5. assist me with a tool or a command to do the same.
I just upgraded to Ubuntu 10.04 yesterday on a headless home server. I use the server for a variety of purposes, and what I don't know how to do via SSH I've alway been able to do through VNC. However, since the upgrade vino-server will no longer run if there isn't a monitor attached. Before it used to start up without a problem. Even by attempting to run the server via SSH gives me a "could not load display" error. Summary: I need to get vino-server running at boot time on a server with Ubuntu 10.04, without a monitor attached.
I have bought a new motherboard (MSI 785GT-E63). I already have an old CRT monitor connected to it. After I install a linux OS to it, my monitor will display that it is:
Out of frequency. Current frequency is 89Hz. The operating output of my monitor is (around) 60-70Hz.
I would like to get this thing work. How can I let my CRT display properly?I was thinking of lowering down video frequency output of my motherboard, but I can't find any settings on my BIOS setup. Additional info:
My monitor is attached directly to the built-in video adaptor of my motherboard. (No additional video
I want to check all the child processes attached to a specific process. Say for a example; my process is a java process. Then I wanna know what are the processes attached to that java process. At the moment I use the command # ps aux|grep java; this gives the details about the currently running java process. So I can kill the whole java process using #kill -9 {pid} ...but there are sub processes attached (I guess child processes) to java process. I wanna view all of them & kill whatever the process I like not the whole thing. I'm using Red hat 5 enterprise edition. and currently a weblogic application server is running on that.
I have a storedge 3511 array attached to a centos 4 system and need to upgrade to redhat 5. 1) How can I find out how the array was attached to the system? and/or 2) What do I need to do during the install for the array to be recognized?
fdisk -l output: WARNING: GPT (GUID Partition Table) detected on '/dev/sde'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sde: 4998.3 GB, 4998352076800 bytes 255 heads, 63 sectors/track, 607681 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sde1 1 267350 2147483647+ ee EFI GPT
I have added some executable scripts to /etc/cron.daily but don't get the stdout/stderr output from them as mail (or anywhere else I have found). At least one of them is running (because I can see that it has added a file to the disk).
The peculiar thing is that I do get the output from /etc/cron.daily/0logwatch (part of the logwatch package) as an email each day.
The MAILTO line in /etc/crontab is "MAILTO=root" (unchanged from default). Same for /etc/anacrontab.
I do have an alias at the end of /etc/aliases which redirects root's mail to my own account, but this alias works fine for mail I send manually. (It also appears to work fine for the output from the file /etc/cron.daily/0logwatch.)
I put in my cron entries to run my backup script which rsyncs my data to my 2nd drive, however on a hunch I checked my backup drive which mounts automatically via fstab and I realize it had not ran in a while. I checked cron and there were no entries for it. I got to wondering if I should ever be worried about a cron update coming down and over-writing my existing cron file with the backup entries in it to run.
I just upgraded to lucid and discovered a nasty bug. It prevents the system from booting and took me hours to resolve. Now I'd like to report it along with the workaround I found. The only problem is: Where? Other such bugs have been filed against "update-manager", but that's just the GUI calling some scripts which do the real work. so what do I do?What should I substitute for XYZ in
I have setup a cluster.Which is basically a few Virtual Machines running and the applications running in them which are accessible on internet. He has asked me to send him a weekly report of this work. I am sys admin guy who understands ssh,telnet,ftp,tftp,TCP I am not able to understand what should I write in report.Because all the servers are perfectly running and applications are also running on top of them and I am done with this.So basically from my part I do not have any ssh or ftp to write in a report like this.Can some one give me a link if there is some sample report that I should send.I am not able to understand what do I need to Google for the same.