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)						      General Commands Manual							  WRITE(1)

NAME
write - write to another user SYNOPSIS
write user [ ttyname ] DESCRIPTION
Write copies lines from your terminal to that of another user. When first called, it sends the message Message from yourname@yoursystem on yourttyname at time... The recipient of the message should write back at this point. Communication continues until an end of file is read from the terminal or an interrupt is sent. At that point write writes `EOT' on the other terminal and exits. If you want to write to a user who is logged in more than once, the ttyname argument may be used to indicate the appropriate terminal name. Permission to write may be denied or granted by use of the mesg command. At the outset writing is allowed. Certain commands, in particu- lar nroff and pr(1) disallow messages in order to prevent messy output. If the character `!' is found at the beginning of a line, write calls the shell to execute the rest of the line as a command. The following protocol is suggested for using write: when you first write to another user, wait for him to write back before starting to send. Each party should end each message with a distinctive signal--(o) for `over' is conventional--that the other may reply. (oo) for `over and out' is suggested when conversation is about to be terminated. FILES
/var/run/utmp to find user /bin/sh to execute `!' SEE ALSO
mesg(1), who(1), mail(1) 7th Edition November 27, 1996 WRITE(1)
All times are GMT -4. The time now is 08:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy