Shift reminder system


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shift reminder system
# 8  
Old 06-16-2011
Here is the template:

Code:
 
today=`date "+%d/%0m/%y"`
 
grep "$today" input_csv  2>/dev/null 1>2&
if [ $? -ne 0 ]; then
echo "no user"
else
grep "$today" input_csv   | while read line 
do
i=get names one by one
e=`sqlplus -s "username/passwd" << EOF
set head off
set echo off
select mailid from user_table where name = "$i";
EOF
`
Check if the name exists by checking whether e is null or not
if e is not null then
mail -s specifi user mail id (stored in e)
done
fi

# 9  
Old 07-06-2011
Thanks for the template but my scenario is that validation needs to be done not only for "Date" part but also for the "name" part since there can be more than one person in a shift.. so there should be some scenario wherin u can get the name and compute their EMPID ..
# 10  
Old 07-07-2011
Hi ,
I am in the last part of this ., can anyone please help me how to send a mail to the group of mail ids got in the variable 'e'...
mail -s "Hello" e., is it right????
# 11  
Old 07-07-2011
Code:
 
mail -s "Hello" $e

# 12  
Old 07-08-2011
Hi .,
I m struck here., cud u plz help...
I have changed some logic in this system., I have loaded my .csv file in another table and now comparing the two tables and fetching the mail id in the variable "e"
The code i used to send mail is
Code:
e=`sqlplus -s "username/pwd@DB" << EOF
select user_table.MAILID from user_table inner join onshore on user_table.RESOURCE_NAME = onshore.MHC;
EOF`
mailx -s "You are in shift today" $e

where onshore is the table made from .csv file.,

i m unable to send the mail., when i execute the script it stands till timeout and gets closed without sending mail...
Thanks in advance...

---------- Post updated 07-08-11 at 11:01 AM ---------- Previous update was 07-07-11 at 06:10 PM ----------

Hi .,
When i execute
Code:
e=`sqlplus -s "username/pwd@DB" << EOF
select user_table.MAILID from user_table inner join onshore on user_table.RESOURCE_NAME = onshore.MHC;
EOF`

alone., i could view the result wen i give echo $e.,
MAILID -------------------------------------------------- ram@abc.com hari@abc.com raj@abc.com MAILID -------------------------------------------------- ram@abc.com hari@abc.com raj@abc.com., but there are only 3 rows in the database.. why i am getting duplicate here???

And also i couldnt send mail using this
mailx -s "You are in shift today" $e., wen i execute i get "mail: illegal option -- ----" error ., Where i went wrong...!!????

Last edited by Franklin52; 07-08-2011 at 03:43 AM.. Reason: Please use code tags for code and data samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shift command help

#!/bin/bash hostname=$1; shift for hostname in $1 do ping $hostname done I want to run the above script as hostname.sh yahoo.com google.com cnn.com. I want to shift each hostname to $1. How can do that with above code as currently it's not shifting. (5 Replies)
Discussion started by: scj2012
5 Replies

2. Shell Programming and Scripting

Use of Shift command

Hello Expert Can any one please explain what is the use of shift command in general terms: set -- $(ls -t) shift rm -Rf $* what is the use of shift command over here. Thanks a lot for your help (2 Replies)
Discussion started by: aks_1902
2 Replies

3. UNIX for Dummies Questions & Answers

A Shift into UNIX

Hi, Firstly, I did a search for this question both on this site and on the internet and have not been able to find a suitable answer that is not general in nature. I have always been a Windows user. I use my girl friend's mac every now and then, but I always come back to windows. For a... (1 Reply)
Discussion started by: mearex
1 Replies

4. UNIX for Dummies Questions & Answers

shift not working

Hi, I wrote one script, in between script needs to use 10th and 11th positional parameters, that time i used "shift". Here i am facing the below find problem, ./DataCount.sh: cannot shift I tried 1) I have read man pages for shift 2) Before but * and ** 3) Simple shift with out giving... (4 Replies)
Discussion started by: Nagapandi
4 Replies

5. Shell Programming and Scripting

shift command

Hi Folks, In shell scripting the maximum no. of command line parameters becomes 9(Am i right). If we want to get more than 9 parameters we use the shift command. Even here there are two possibilities. 1. Without the use of variables - The arguments are lost and the lost no. is equal to the... (6 Replies)
Discussion started by: Nisha
6 Replies

6. UNIX for Dummies Questions & Answers

shift command

There is an error when i am trying to use the shift command in this way: ($1 = -d, $2 = 123, $3 = -c etc etc) for $arg in $@ do case $arg in "-d") shift; (so that the $2 will become the $arg now) (and while it loop the 2nd time,) ... (1 Reply)
Discussion started by: AkumaTay
1 Replies
Login or Register to Ask a Question