Sponsored Content
Full Discussion: at reminder script
Homework and Emergencies Homework & Coursework Questions at reminder script Post 302561630 by csharp100 on Tuesday 4th of October 2011 04:14:26 PM
Old 10-04-2011
Ok, so I got the last problem straightened out and now I have another. It seems I am so close yet so far away. Here is my code;
Code:
#!/usr/dt/bin/dtksh
# Alertme.p1 program, version 0.5
# Author - Clint Sharp
mkdir ~/Msgs
echo "\nEnter your reminder message.
When finished, enter a period (.) at
the beginning of a line and press <ENTER>.
(Or press Ctrl-C to exit the script)\n"
while :
do
        read MESSAGE
        if [ "$MESSAGE" = "." ]
        then
                break
        else
                echo $MESSAGE >> ~/Msgs/message.$$
        fi
done
echo "\nEnter the time and day you want to
receive the message, for example:
0815am Jun 14
8:15am Jun 14
now + 1 day
5 pm Friday
Then press <ENTER>\n"
read TIME 
echo "\nAt $TIME mail or write $LOGNAME ~/Msgs/message.$$\n"
at -k $TIME << !!
who | cut -c1-20 | grep $LOGNAME | cut -c12-20 | cat > ~/tmp
while read inputline
do
        write $LOGNAME $inputline < ~/Msgs/message.$$ #|| mail $inputline < ~/Msgs/message.$$
done < ~/tmp
rm -r ~/Msgs
rm -r ~/tmp
exit 0

What is happening is I will have two terminal sessions opened to test this script and it is sending two messages to the same terminal. The one that originally initiated the script. I also get a mail message that says,
Code:
Your "at" job on admiral
"/var/spool/cron/atjobs/1317758851.a"
produced the following output:
I cannot determine your terminal name. No reply possible.
cs368 is logged on more than one place.
You are connected to "pts/26".
Other locations are:
pts/98Warning: You have your terminal set to "mesg -n". No reply possible.
I cannot determine your terminal name. No reply possible.
cs368 is logged on more than one place.
You are connected to "pts/26".
Other locations are:
pts/98Warning: You have your terminal set to "mesg -n". No reply possible.

On the terminal pts/98 I did change message to "yes" using the -y switch. I do not think this is the problem though. Can anyone help?
 

2 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Reminder script not working...

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: We have been tasked to write an at reminder script that will write or echo a message to more than one user. What... (11 Replies)
Discussion started by: csharp100
11 Replies

2. OS X (Apple)

A simple reminder script for beginners to shell scripting.

(Apologies for any typos.) Well hands up those who have been in the following situation(s):- Your partner, (in my case the missus), sees that you are messing with your machine and says something like, "can you keep an eye on the dinner, I am going out shopping", and you look up glazed eyed... (3 Replies)
Discussion started by: wisecracker
3 Replies
WRITE(1)						    BSD General Commands Manual 						  WRITE(1)

NAME
write -- send a message to another user SYNOPSIS
write user [tty] DESCRIPTION
The write utility allows you to communicate with other users, by copying lines from your terminal to theirs. When you run the write command, the user you are writing to gets a message of the form: Message from yourname@yourhost on yourtty at hh:mm ... Any further lines you enter will be copied to the specified user's terminal. If the other user wants to reply, they must run write as well. When you are done, type an end-of-file or interrupt character. The other user will see the message 'EOF' indicating that the conversation is over. You can prevent people (other than the super-user) from writing to you with the mesg(1) command. If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the termi- nal name as the second operand to the write command. Alternatively, you can let write select one of the terminals - it will pick the one with the shortest idle time. This is so that if the user is logged in at work and also dialed up from home, the message will go to the right place. The traditional protocol for writing to someone is that the string '-o', either at the end of a line or on a line by itself, means that it is the other person's turn to talk. The string 'oo' means that the person believes the conversation to be over. SEE ALSO
mesg(1), talk(1), wall(1), who(1) HISTORY
A write command appeared in Version 1 AT&T UNIX. BUGS
The sender's LC_CTYPE setting is used to determine which characters are safe to write to a terminal, not the receiver's (which write has no way of knowing). The write utility does not recognize multibyte characters. BSD
July 17, 2004 BSD
All times are GMT -4. The time now is 07:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy