Sponsored Content
Top Forums Shell Programming and Scripting SendEmail - Script reading database file with sleep command Post 302818665 by baris35 on Saturday 8th of June 2013 07:03:14 AM
Old 06-08-2013
SendEmail - Script reading database file with sleep command

Hello,
I would like to send email message to my mail list.
I have been running linux based server and I submitted this process manually up to now.
I would like to send each individual with a shell script.

In ssh panel, I tested below command and it works smoothly.

Code:
sendEmail -t member1@hotmail.com -f myemail@mail.com -u Hello There! < /var/log/body.txt

I created all ssh lines for each member and put them into a ssh file, then run the script. Here it is:

sendmail.sh
Code:
#!/bin/bash
sendEmail -t member1@hotmail.com -f myemail@mail.com -u Hello There! < /var/log/body.txt &
sleep 5
sendEmail -t member2@hotmail.com -f myemail@mail.com -u Hello There! < /var/log/body.txt &
sleep 5
sendEmail -t member3@hotmail.com -f myemail@mail.com -u Hello There! < /var/log/body.txt &
sleep 5
sendEmail -t member4@hotmail.com -f myemail@mail.com -u Hello There! < /var/log/body.txt &
sleep 5
exit 0

If I do not put "sleep" command in shell script, the server gives error.

In ssh panel:
Code:
./sendmail.sh

My excel file is in below form:

Code:
member1@hotmail.com    Name1    Surname1
member2@hotmail.com    Name2    Surname2
member3@hotmail.com    Name3    Surname3
member4@hotmail.com    Name4    Surname4
member5@hotmail.com    Name5    Surname5

Do not know which file extension should be used instead of excel file.
How can I change above script so that it reads mail-list database file and submit email to each member one by one with five seconds of interval.

Please help me.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reading command output from shell script

Hi List, How to read the output of a command executed from a script. For ex. sample_scritp.sh ------------- useradd testuser1 password testuser1 .... ..... -------------- This prompts for "password", and "confirm password", for which i need to give the values from script. Can... (4 Replies)
Discussion started by: sri b
4 Replies

2. Shell Programming and Scripting

how to insert data into database by reading it from a text file??

Hi....can you guys help me out in this script?? Below is a text file and it contains these: GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001 GEF001 000093625 MKL005675 000001... (4 Replies)
Discussion started by: pallavishetty
4 Replies

3. Shell Programming and Scripting

question about "sleep" command in expect script

I wrote some expect script to telnet to some device to execute some commands.Firstly,I can't get full result some time,then I try to add some "sleep" command in it.Fortunately it works. My idea about it is that it uses sleep command to wait the result to be displayed.Am I right or correct the... (4 Replies)
Discussion started by: robbiezr
4 Replies

4. Shell Programming and Scripting

Reading data from DataBase and Writing to a file

Hi All, Please help me in writing data to a file in one row. In database there is a column which contains large data which does not fit in the file in one row. The column contains list of paths. I want to write these paths to a file in one row. Please find the code below writes : ... (2 Replies)
Discussion started by: rajeshorpu
2 Replies

5. Shell Programming and Scripting

passing database password to isql command in shell script

Hi, I need to connect to DB through my shell script. but I dont want to hardcode my db password in the script. Is there a way to do it? Thanks ---------- Post updated at 07:42 PM ---------- Previous update was at 04:54 PM ---------- :(Guys..please help me with this:( (1 Reply)
Discussion started by: agrawal.prachi
1 Replies

6. Shell Programming and Scripting

script to check for existence of file (or else sleep for x time)

Hi Forum. I have a script that accepts 3 input parameters (source directory, list file text, sleep time) and checks for the presence of files. If not there, script goes to sleep for certain amount of time provided by 3rd input. list file text contains 1 entry but may contain more (file... (13 Replies)
Discussion started by: pchang
13 Replies

7. Programming

Reading rpm database from windows.

Hello, I want to read a rpm database through my program in c ,I searched for it and found there is one library openly available that is rpmlib thorugh which we can access rpm databse but I want to use it from windows is it possible to read one rpm database from windows,I want to read the... (4 Replies)
Discussion started by: pradiptart
4 Replies

8. Shell Programming and Scripting

sendEmail: Script and Array

I have a script that send email using sendEmail (CentOS shell) script is: sendEmail -vvv -u "TestCompany, Inc.: USB Added" -f user@domain.com -t To@domain.com -s ASPMX.L.GOOGLE.com -m "USB Activity" -o tls=aut o username=user3@domain.com password=password So far this works fine. Now i... (5 Replies)
Discussion started by: kashif.live
5 Replies

9. Shell Programming and Scripting

how to assign ip after reading it from a database

Hi, I'm new to Red Hat. i have a database "work1" which has a table "dd_interface". This table has a column "ip", i have displayed this ip on the command terminal, i want this ip to be assigned eth0.... Can anyone help me with this???? Regards, Owais ---------- Post updated at 02:54 PM... (1 Reply)
Discussion started by: Owais.Ahmad
1 Replies

10. UNIX for Dummies Questions & Answers

Help with reading and calling a command in a script

The problem I am having now is calling and reading a command and The Main script reads the data file and passes the input to the two calculation scripts, and than output to a file. 1. The Main Script ----------------- input=inputfilepj3 output=outfilepj3 echo "*** Converting... (2 Replies)
Discussion started by: TheUnitedOSI
2 Replies
AMANDA-SCRIPTS(7)						    Miscellanea 						 AMANDA-SCRIPTS(7)

NAME
amanda-scripts - Configuring and using the Script API DESCRIPTION
The Script API is a flexible system for invoking user-supplied scripts at various points in the execution of Amanda. This manual page describes the operation and configuration of the API. For help writing Script API scripts, see http://wiki.zmanda.com/index.php/Script_API. SCRIPTS
This section lists the scripts included with Amanda, see the individual man page for instructions on using them. For complete How-To information, consult the Amanda wiki at http://wiki.zmanda.com. o amzfs-snapshot(8), - create/destroy zfs snapshot. o script-email(8), - send email. Script properties work just like application properties: they are insensitive to case, and - (dash) and _ (underscore) may be used interchangeably. SCRIPTS OUTPUT PROPERTY
A pre-dle-amcheck, pre-dle-estimate or pre-dle-backup executed on the client can output property on stdout that are sent to the application. If the output line matches "PROPERTY str1 str2", Amanda sets a property called "str1" by the value of "str2", that property is sent to the application. SEE ALSO
amanda(8), amanda.conf(5) The Amanda Wiki: : http://wiki.zmanda.com/ AUTHORS
Jean-Louis Martineau <martineau@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Dustin J. Mitchell <dustin@zmanda.com> Zmanda, Inc. (http://www.zmanda.com) Amanda 3.3.3 01/10/2013 AMANDA-SCRIPTS(7)
All times are GMT -4. The time now is 05:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy