LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 12-17-2001, 06:10 AM   #1
jamesyreid
LQ Newbie
 
Registered: Dec 2001
Posts: 3

Rep: Reputation: 0
Cron Email Notification(?)


Hi,

I have a problem relating to a cron task that I am trying to schedule, and I'd be grateful if someone could shed some light on it...

I have added a new user to my Linux webserver, and when they login they can then upload files to their home directory using Secure Shell. I have then scheduled a cron job to run every hour which will copy the reports from the user's home directory to the relevant areas of our website (so that the reports appear online).

With me so far?

This all works fine, however the user has asked me if it is possible to setup some sort of email notification, whereby an email alert will be sent to an external email address whenever a report they have uploaded is copied across to the website. It's basically to let one of our customers know every time there is a new report available for viewing online.

Probably another cron job is the most obvious solution, but I'm afraid I don't know where to start. Is it possible to set-up auto email notification using cron?

Any assistance would be gratefully received!
 
Old 12-17-2001, 10:21 AM   #2
speck
Member
 
Registered: Nov 2001
Location: California
Distribution: Slackware 14.1
Posts: 271

Rep: Reputation: 54
You should put the copying of the files to the webserver in a script (perl, shell, etc.) and execute that script in the cron. It's then pretty trivial to test if the file exists and send a notification if true. A basic shell example would be:

#! /bin/sh

if [ -s newfile.html ]
then
cp newfile.html /newpath/newfile.html
mail -s "New file for you" joe@aol.com
fi


If there are multiple files and they can have any name, I would suggest coding the script in perl. That's a bit more complicated, but not hard at all. If you need it, I can post examples of that as well.

Speck
 
Old 12-17-2001, 10:30 AM   #3
jamesyreid
LQ Newbie
 
Registered: Dec 2001
Posts: 3

Original Poster
Rep: Reputation: 0
Cron

Yes, some perl examples would be greatly appreciated!

Thanks in advance,

James
 
  


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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Email Notification - Perl Script jamesyreid Programming 3 07-21-2009 07:56 AM
cron e-mail notification adm1329 Linux - Newbie 1 06-20-2004 07:27 PM
email notification mbegovic LQ Suggestions & Feedback 6 04-01-2004 12:36 PM
Suppress mail notification of cron event? jecoltrin Linux - General 2 02-02-2004 12:37 PM
email notification elainepearl Linux - General 1 01-14-2002 05:58 AM


All times are GMT -5. The time now is 01:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration