LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-30-2006, 06:57 AM   #1
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Rep: Reputation: 15
Question Send mail through script


Hi guys,

I have my laptop running at home FC5 and a scientific app which updates from time to time a log file about its state (pspc_log.lst).

Is there any way of sending this log file each 2 hours, for example, as a mail attachment to my work account so I could follow it with discretion without any VNC or other remote
tool running.

Thanks in advance!

Last edited by aabfm; 06-30-2006 at 06:59 AM.
 
Old 06-30-2006, 07:08 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,174
Blog Entries: 1

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
You can setup a cronjob to run every 2 hours, to execute the following command:
Code:
/usr/bin/mail -s "logs"  name@domain.com < /path/to/logs/logfile.log
 
Old 06-30-2006, 11:32 AM   #3
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Original Poster
Rep: Reputation: 15
Thumbs up

It works!
Just one question:
If I re-install FC5 do I have to turn some option on in order to have the "mail" available?
Thanks.
 
Old 06-30-2006, 11:51 AM   #4
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Original Poster
Rep: Reputation: 15
Sorry, I forgot!...
One other question:
How do I send 2 files instead of 1?
Thanks!
 
Old 06-30-2006, 04:10 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,174
Blog Entries: 1

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
AFAIK the mail program (also known as mailx or nail) is installed by default in most distros. There is also mutt that works the same way.
If you want to send 2 files use the same command 2 times
 
Old 07-01-2006, 04:46 AM   #6
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Original Poster
Rep: Reputation: 15
Thanks!
You've been an important help.
 
  


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
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
How do I send mail from inside a script? bruno buys Linux - Software 3 10-06-2004 07:57 PM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 09:57 AM
bash script to send mail Cruger Programming 1 03-06-2004 08:25 AM
I'm looking for a simply perl script to send mail, when ping down cccc Programming 2 01-12-2004 04:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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