LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-19-2004, 05:55 AM   #1
Sn7
LQ Newbie
 
Registered: May 2004
Posts: 25

Rep: Reputation: 15
Mailing a file on a regular basis


Hi

I need to execute a program which generates file say file.log, I need to execute this process every friday and mail this file off to a mail address. How can I set this up... I don't know cron/sendmail at all :-(

Can anyone please help me

Thanks
 
Old 07-19-2004, 07:24 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You could set up a script like:
Code:
#!/bin/bash

echo `date` Mailing log
cat /path/to/file.log | mail user@host.com -s "My log file"
Make it executable, then create a cron job like:
* 22 * * * /path/to/script > /var/log/script.log 2>&1
 
Old 07-19-2004, 07:47 AM   #3
Sn7
LQ Newbie
 
Registered: May 2004
Posts: 25

Original Poster
Rep: Reputation: 15
Thanks, How does cron work, if I want to let it do this on friday night at 22H00 how do I do it and what file do I edit?
 
Old 07-19-2004, 08:13 AM   #4
Sn7
LQ Newbie
 
Registered: May 2004
Posts: 25

Original Poster
Rep: Reputation: 15
Just another thing, when I reiceve the mail, it's in text - can't I make it so that it's an attachment?

Thanks
 
Old 07-19-2004, 08:37 AM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
If you wan't an attachment then you will probably want to use perl and the MIME::Lite module.

The 5 fields at the start of the crontab entry specify when the job is run. For a full explanation see:
man crontab
 
  


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
mailing myself at regular intervals... piyushiitk Programming 4 08-21-2005 10:26 AM
How to know if it's regular file in C fei Programming 2 08-15-2004 10:09 AM
syntax for mailing a file dong@aproposret Linux - General 4 03-11-2004 01:49 PM
How can I read regular file in kernel module jooboo Programming 5 12-30-2003 07:11 PM
limit CPU on a per user basis? adenardo Linux - Security 1 11-13-2001 11:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:24 PM.

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