The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to forward mail in /var/mail/username to external mail unitipon SUN Solaris 2 05-26-2008 09:20 PM
Pull E-mail address from file, send e-mail DC Heard Shell Programming and Scripting 1 01-28-2008 11:23 PM
I am not able to send mail form unix to other mail accounts. chinnigd UNIX for Dummies Questions & Answers 1 04-06-2006 05:31 AM
can not send mail from unix server to company/yahoo mail b5fnpct UNIX for Dummies Questions & Answers 5 11-22-2002 06:24 PM
/var/log/httpd/access_log eddie Security 3 10-01-2001 09:52 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-27-2001
Registered User
 

Join Date: Nov 2001
Location: California
Posts: 2
mail access_log

i am trying to figure a way to email my access_log twice a month to myself right before the system zeros it.

using crontab is the way to go, but the command to get mail to do the job is my problem.

#-------------------------------------------
#0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#min hour date month day command
#-------------------------------------------

* 0 * 15 * * cat home/aherbel/logs/access_log.resolved | tar access.tar | gzip access.tar.gz | mail -s ",subject,email@domain.com

* 0 * 30 * * cat home/aherbel/logs/access_log.resolved | tar access.tar | gzip access.tar.gz | mail -s ",subject,email@domain.com


i got most of this from the FAQ's, but got this error.


/bin/sh: -c: line 2: syntax error: unexpected end of file

thanks
__________________
http://DayGlowDesigns.com/
Forum Sponsor
  #2  
Old 11-27-2001
Registered User
 

Join Date: Nov 2001
Posts: 35
When you use pipe [ | ] you must work with stdin and/or stdout, not filenames. At the second, you didn't write tar command. At the third - why do you want to tar 1 file ?

At the fourth - "mail" don't send you compressed file as attachement but as message body. You have to use some combination of the MIME command to create attachement. Better is to use "mutt"

Your command pipe should be as folows:

cat logfile | gzip logfile.gz; mutt -s "logfile" -a logfile.gz email@domain.com
  #3  
Old 11-27-2001
Registered User
 

Join Date: Nov 2001
Location: Maryland
Posts: 20
also instead of having two lines in the crontab, you could just have one. (although two is fine)

* 0 * 15,30 * * cat logfile | gzip logfile.gz; mutt -s "logfile" -a logfile.gz email@domain.com
  #4  
Old 11-27-2001
Registered User
 

Join Date: Nov 2001
Location: California
Posts: 2
#-------------------------------------------
#0-59 0-23 1-31 1-12 0-6 (0=Sunday)
#min hour date month day command
#-------------------------------------------


59 23 14 * * * metasend -b -t email@domain.com -s "Logs" -mtext/plain -f ~/logs/access_log.resolved

59 23 30 * * * metasend -b -t email@domain.com -s "Logs" -mtext/plain -f ~/logs/access_log.resolved

This works except for reading the file when i get it. it sends three separate parts and i can't figure out how to combine the parts and decode. i looked at the source and it appears to be rich text.
__________________
http://DayGlowDesigns.com/
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0