LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-05-2011, 11:01 AM   #1
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Rep: Reputation: 10
scheduler Script


Hi,

My requirement is i want to send mails from server to all my employess with one attachment file for every monday and friday like scheduler.. how it is possible through bash script. please guide me..
 
Old 04-05-2011, 12:03 PM   #2
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 595

Rep: Reputation: 115Reputation: 115
http://www.zedwood.com/article/103/b...-an-attachment

Then use cron to schedule execution of the script.
 
Old 04-05-2011, 01:36 PM   #3
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Original Poster
Rep: Reputation: 10
Hi zordrak,

Mail is not a prob but...i need to send same attachment to N number of mail ids for example


if i have 3 mail ids means

07anis@gamil.com
anish@gamil.com
kumar@gmail.com

at the same time i need to send mail from server to this 3 mail ids.


i think using script we can do that..

like we need to assign all the mail ids store into one file form that we need to get input..that code only i am searching how to do that process...if you have any idea means please share..
 
Old 04-05-2011, 01:41 PM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
Lightbulb

Hi Anish,

You can put all emailIDs in a file say email.txt and use this code
Code:
for i in `cat email.txt`;
do
mutt -s "Your Suject" -a "/your/attachement" $i > /dev/null
done;
Note: Always mention your OS and version when post a query.

Last edited by vikas027; 04-05-2011 at 01:46 PM.
 
1 members found this post helpful.
Old 04-05-2011, 08:04 PM   #5
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Original Poster
Rep: Reputation: 10
Hi vikas
Code:
#!/bin/bash
#### SCHEDULER ####
date=$(date +%d-%m-%y)
for i in `cat mail.txt`;
do
mutt -s "Task Scheduler" -a"/root/Desktop/1.png" $i > /dev/null
done;
when i execute this code its not working after this step..

Quote:
++ date +%d-%m-%y
+ date=06-04-11
++ cat mail.txt
+ for i in '`cat mail.txt`'
+ mutt -s 'Task Scheduler' -a/root/Desktop/1.png 07anis@gmail.com
 
Old 04-06-2011, 05:45 AM   #6
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by anishkumarv View Post
Hi vikas
Code:
#!/bin/bash
#### SCHEDULER ####
date=$(date +%d-%m-%y)
for i in `cat mail.txt`;
do
mutt -s "Task Scheduler" -a"/root/Desktop/1.png" $i > /dev/null
done;
when i execute this code its not working after this step..
Do you have mutt installed ?
Post what errors you are getting and output of below command
which mutt
 
1 members found this post helpful.
Old 04-06-2011, 06:47 PM   #7
anishkumarv
Member
 
Registered: Feb 2010
Location: chennai - India
Distribution: centos
Posts: 289

Original Poster
Rep: Reputation: 10
Code:
#!/bin/bash
#### SCHEDULER ####
date=$(date +%d-%m-%y)
for i in `cat mail.txt`;
do
mutt -s "Scheduler" -a /root/Desktop/1.png $i < /root/message
done;
Hi All
Thanks for your Reply Its Working fine now!!!
 
Old 04-07-2011, 05:14 AM   #8
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Debian, OS X
Posts: 1,298

Rep: Reputation: 102Reputation: 102
Hi Anish,

Glad you made it.
Please mark this thread as solved.
 
  


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
linux scheduler sunita Linux - Newbie 2 03-14-2011 11:07 AM
scheduler patches anjana Linux - General 1 05-28-2007 10:33 PM
1 micro second scheduler manas_sem Programming 7 03-15-2007 10:04 PM
scheduler... os2 Programming 0 07-24-2004 01:38 PM
scheduler -a process??? mojozoox Linux - General 1 08-25-2003 01:53 AM


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