Sponsored Content
Full Discussion: at reminder script
Homework and Emergencies Homework & Coursework Questions at reminder script Post 302565233 by csharp100 on Monday 17th of October 2011 10:34:42 AM
Old 10-17-2011
Got it! Here is the correct code. Still needs some efficiency put into it but it will work for the time being.
Code:
#!/usr/dt/bin/dtksh
# Alertme.p1 program, version 0.7
# Author - Clint Sharp
# This program is interactive and will alert the user
# if they are online at more than one terminal. It will also mail the
# user at the mail address associated with the user id.
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
8:15am 6/14/2011
Then press <ENTER>\n"
read TIME
echo "\nAt $TIME mail or write $LOGNAME ~/Msgs/message.$$\n"
at -k $TIME << EOF
if ! who | grep ^$LOGNAME > /dev/null; then
mail $LOGNAME < ~/Msgs/message.$$
fi
if [ `who | grep -c "$LOGNAME"` -gt 0 ]; then
who | cut -c1-20 | grep $LOGNAME | cut -c12-20 | while read LINE
#while read inputline
do
    write $LOGNAME \$LINE < ~/Msgs/message.$$ > /dev/null 2>&1
done
fi
rm -r ~/Msgs

exit 0
EOF

 

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

NAME
Rnmail - a program for replying via mail SYNOPSIS
Rnmail destination_list or Rnmail -h headerfile [oldarticle] or Rnmail DESCRIPTION
Rnmail is a friendly interface for mailing replies to news articles. It will ask several questions, then allow you to enter your letter, and then mail it off. If you type h and a carriage return at any point, Rnmail will tell you what it wants to know. The -h form is used when invoked from rn. If your editor can edit multiple files, and you want the article to which you are replying to show up as an alternate file, define the environment variable MAILPOSTER as "Rnmail -h %h %A". You can also modify the the MAILHEADER environment variable to change the header file that rn passes to Rnmail. ENVIRONMENT
DOTDIR If defined, specifies a place other than your home directory where 'dot' files may be stored. This is primarily for accounts which are shared by more than one person. Default: $HOME EDITOR The editor you want to use, if VISUAL is undefined. Default: whatever your news administrator installed, usually vi. HOME Your home directory. Default: $LOGDIR LOGDIR Your home directory if HOME is undefined. LOGNAME Your login name, if USER is undefined. Default: value of "whoami". MAILRECORD If defined, contains the name of a file to which the finished message will be appended. Default: message not saved ORGANIZATION Either the name of your organization, or the name of a file containing the name of your organization. Default: whatever your news administrator chose. USER Your login name. Default: $LOGNAME VISUAL The editor you want to use. Default: $EDITOR FILES
$DOTDIR/.letter ~/dead.letter SEE ALSO
rn(1), Pnews(1), mail(1) DIAGNOSTICS
BUGS
Uses /bin/mail in the absence of sendmail. LOCAL RNMAIL(1)
All times are GMT -4. The time now is 03:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy