LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-05-2006, 06:28 PM   #16
patrick295767
Member
 
Registered: Feb 2006
Distribution: FreeBSD, Linux, Slackware, LFS, Gparted
Posts: 664

Rep: Reputation: 138Reputation: 138

Quote:
Originally Posted by twantrd
This is what I would do:

Code:
#!/bin/bash

echo "enter subject"
read sub

echo "enter message"
read mess

echo "mail to"
read letter

echo "please enter day of month to send mail"
read day

echo "0 23 $day * * cat \"$mess\" | mail -s \"$sub\" $letter" > /tmp/cron.mail
crontab /tmp/cron.mail

And here are the results:

twantrd@twantrd:~$ /tmp/test
enter subject
Hi there
enter message
How are you?
mail to
me@mydomain.com
please enter day of month to send mail
15
twantrd@twantrd:~$ crontab -l
0 23 15 * * cat "How are you?" | mail -s "Hi there" me@mydomain.com

So, this is just one script that does all the work for you and it's pretty simple once you look at it. This will set the cronjob for that user to mail out that message at 11:00pm on the 15th of every month.

-twantrd
Both are not working ?....
Should I setup something for the pop and other stuffs ..??
should I use a .forward ?

Thank you very much !!

Patrick
 
Old 03-06-2006, 01:59 PM   #17
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Quote:
Both are not working ?....
Should I setup something for the pop and other stuffs ..??
should I use a .forward ?

Thank you very much !!

Patrick
What doesn't work? Is cron running the script at all? Did you try running the command manually and it worked? We need more info to help you here.

-twantrd
 
  


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
schedule problem omerlh Linux - Software 1 01-11-2006 02:15 PM
Schedule a task ! L1nuxbug Linux - Networking 4 03-02-2005 07:54 PM
Mandrake 10.1 Schedule is Up colnago Mandriva 0 03-25-2004 01:29 PM
Schedule, AGAIN!! erathomor Linux - General 0 04-11-2002 11:25 AM
HOW TO Schedule erathomor Linux - General 3 04-10-2002 01:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:07 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