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
lmfsetup(8)						      System Manager's Manual						       lmfsetup(8)

Name
       lmfsetup - License Management Facility PAK registration script

Syntax
       /etc/lmfsetup [ template ]

Description
       The  script allows you to register data supplied by a Product Authorization Key (PAK).  The script prompts you for the data associated with
       each of the fields on a PAK.  When all the data has been entered, the License Management Facility (LMF) ensures there are  entries  against
       all  the mandatory fields, and that the Checksum validates all the license data.  If the data has been entered correctly, the PAK is regis-
       tered in the License Database.  If the data has been entered incorrectly, the appropriate error message is displayed and you are given  the
       opportunity to re-enter the data.

       The template option allows you to register license data from templates in A template containing a partially complete PAK is created by some
       products as part of their installation process.	The script only prompts you for data on the fields that are empty in the template.  If the
       script cannot find the specified template in it searches the current directory.

       The  script  is	provided as an alternative to the command.  This displays a template, which includes the fields on the PAK, and invokes an
       editor so that you can add the license data to the appropriate field.  The command also allows errors to be corrected without having to re-
       enter all the data.

See Also
       lmf(8)
       Guide to Software Licensing

																       lmfsetup(8)
All times are GMT -4. The time now is 03:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy