How to send email once a day at certain time in unix shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to send email once a day at certain time in unix shell script
# 1  
Old 07-27-2010
Question How to send email once a day at certain time in unix shell script

hi,

i have to send an email once a day at ceratin time say 22.
i have tried with date commad, but not working.Smilie
Code:
HOUROFTHEDAY=`date +'%H'`
 
if [ $HOUROFTHEDAY = "22" ]; then
 
    mailx -s  "Info"  emailid@org.com  < $ProcessStatisticsFile
   fi

Please help me...
# 2  
Old 07-27-2010
Why not use crontab ?
# 3  
Old 07-27-2010
can you please tell me how to use crontab ?
# 4  
Old 07-27-2010
# 5  
Old 07-27-2010
Create a script...with following line like ....and save it.
Code:
mailx -s "<subject line>" <email-id>  #u can also add text to mail u know how to do that

Then use below options,
Code:
crontab -e     Edit your crontab file, or create one if it doesn't already exist.
crontab -l     Display your crontab file.

follow ex below:-
to run a script at 22 PM EVERYDAY make this enrty in crontab file and save-------
Code:
0     22     *     *     *         <mention the complete path of the script that u created above>

This will do the job

Last edited by Franklin52; 07-29-2010 at 03:49 AM.. Reason: Please use code tags, thank you!
# 6  
Old 07-29-2010
Thank You
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to send a file in UNIX through email which is created only 15 minutes before the current time?

I wanted to send an email to the client whenever there is failed record created in a /feed/HR-76/failed folder after processing of feed file. I can find out with the help of below script that what is the new file created but that file didn't make just 15 minutes before. ... (1 Reply)
Discussion started by: puneetkhullar
1 Replies

2. Shell Programming and Scripting

how to send html email from shell script

This is my below script which is working fine as it send only plain text email. So My question is- How can I modify my below script to send this as an HTML formatted email? I want to show the text color of this expression `(echo "100*$TEST2/$TEST1" | bc -l)` as `RED` in an email and that can be... (3 Replies)
Discussion started by: raihan26
3 Replies

3. Shell Programming and Scripting

Help with shell script to send email once

Hi Guys, I have this script which will monitor oracle db process if up or down.And I want it to send email if it's down and the time it's back to online. However my script just keep on sending "Email Up" if the db is up or "Email Down" if the db is down.Is there any way to trap it so that it... (5 Replies)
Discussion started by: d3xt3r
5 Replies

4. Shell Programming and Scripting

Logic to send email alerts only 5 times a day

Hi, I have written below disk space monitoring script to monitor disk space every minute. I have scheduled this script through cron. But now my problem is this script alerts the users continuously until the space is freed up. These emails are filling up the inbox exponentially until the space... (3 Replies)
Discussion started by: svajhala
3 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. Shell Programming and Scripting

How to send email through shell script

Hi All, I am new to the unix , i have to deliver one script very urgently I have to write a shell script where i have i want to send email to specific email id in this script i want FROM to be parameterized and stored in a variable TO to be parameterized and stored in a variable... (3 Replies)
Discussion started by: nileshbhawsar
3 Replies

7. Shell Programming and Scripting

How to send email using shell script in UNIX, Is any environment setup required in Mac OS X ?

Hi All, I am using Mac OS X (Leopard OS). I am very new to UNIX. My requirement is that, by running a shell script, I create a log file. So I have to send a mail having that log file attached. What I tried to do is, I simply tried to check,whether this direct command works or not. So I... (2 Replies)
Discussion started by: Afreen
2 Replies

8. Shell Programming and Scripting

script that reads a value and send an email on 89th day

hi all, Currently in my system a user's password expires after 90 days and the last passsword change time is stored in an attribute pwdchange date. i need a linux script that read this attribute and add 89 days and send an email that the user password is expiring the next day. i can store... (1 Reply)
Discussion started by: manankapoor
1 Replies

9. Shell Programming and Scripting

make un shell script to send email

Hi, Someone Knows how to obtein a chain from a unix file, but not all the line, for exemple, for this file ,obtein only 902111111 and to keep the value, this value will be used to make a mailx. NF=ALL, SUBJ= FROM: SN=CD, SE=TOPCALL, NA=, N=902111111, N=TCLFI TO: SE=FAX, NA=, C1=... (0 Replies)
Discussion started by: peybol
0 Replies

10. Shell Programming and Scripting

How to write a shell script to send an email to an id

Hi all, I want to know how to send an email using shell script ..... I tried a command call mail but it did not work.. Please any one reply.. With example if you know thanks.. Madhu (4 Replies)
Discussion started by: madhumathikv
4 Replies
Login or Register to Ask a Question