v07i062: Nag reminder service, Part01/02

sources-request at mirror.TMC.COM sources-request at mirror.TMC.COM
Tue Nov 11 03:46:31 AEST 1986


Submitted by: daveb at rtech.uucp (Dave Brower)
Mod.sources: Volume 7, Issue 62
Archive-name: nag/Part01

This is a program I use to warn me about upcoming meetings and other
events I need to be forcefully provoked to attend.  It has been used on
CCI Power6-BSD, CCI-Power 6-SV and the AT&T Unix-PC.

[  The comparison with other programs, given in the README, is interesting.
   --r$  ]

#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	README
#	nag.1
#	Makefile
# This archive created: Fri Sep 12 16:16:27 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'README'" '(1410 characters)'
if test -f 'README'
then
	echo shar: over-writing existing file "'README'"
fi
sed 's/^X//' << \SHAR_EOF > 'README'
XDescription
X-----------
X
XNag and okok are provide a reminder service for people who need
Xa *lot* of provocation before doing something.
X
XThe system lets you run arbitrary commands at intervals around
Xspecified events.  For instance, you can echo a message 15, 10,
Xand 5 minutes before a meeting.  The configuration is kept in a
X~/.nag file.  You add and alter events with your favorite
Xeditor.
X
XOkok (which is just a link to nag) provides a simple way of
Xshutting up messages once you've gotten the point.
X
XYou start a nag daemon in your .login or .profile.  It puts
Xitself in the background and exits after you log off.
X
XThe system works correctly if you are logged into multiple
Xterminals. Each login gets it's own daemon issuing messages on
Xeach terminal. Running okok on one will silence output on all
Xthe others.
X
XComparisons with existing facilities
X------------------------------------
X
Xat:
X	* Makes you post the events.
X	* No intervals
X	* Not available to all users.  Even on SV.2 with user cron tables,
X	  you need special permission in cron.allow.
X	* Doesn't know when you log out.
X
Xcron:
X	* No intervals.
X	* Not available to all users.  Even on SV.2 with user cron tables,
X	  you need special permission in cron.allow.
X	* Doesn't know when you log out.
X	* Hard to turn off.
X
Xcalendar:
X	* One mail message only (too easy to ignore).
X	* No subject line in the mail.
X
Xleave:
X	* Inadequate flexibility.
SHAR_EOF
if test 1410 -ne "`wc -c 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 1410 characters)'
fi
echo shar: extracting "'nag.1'" '(3319 characters)'
if test -f 'nag.1'
then
	echo shar: over-writing existing file "'nag.1'"
fi
sed 's/^X//' << \SHAR_EOF > 'nag.1'
X.TH NAG 1 "Thu Sep  4 11:48:01 PDT 1986"
X.SH NAME
Xnag \- annoying reminder service daemon.
X.SH SYNOPSIS
X.B nag
X.br
X.B okok
X.SH DESCRIPTION
X.I Nag
Xissues reminders from your ~/.nag file as specified.  You start
X.I nag
Xin your
X.I .profile
Xor
X.I .login,
Xwhere it lies around much like
X.I leave(1)
Xuntil you logout.  It reads the .nag file, and executes reminder
Xcommands at intervals before a time.  Reminders are silenced with
X.I okok.
XWhen you log off,
X.I nag
Xexits just before it would have executed a command on your behalf.
X.PP
X.I Nag
Xignores interrupts, quits and terminates.  To get rid of it, you can log
Xoff or use ``kill \-9.''
X.PP
XThe .nag file has the format:
X.nf
X
X	[ status ] day time interval command
X.fi
X.PP
X.I status
Xis either
X.br
X(1) '#', marking a comment line
X.br
X(2) ':', turning off execution of commands for the event.
X.PP
X.I day
Xis one of
X.br
X(1) A date such as mm/dd/yy, or reasonable alternatives.
X.br
X(2) `*' meaning every day.
X.br
X(3) A day of the week.
XDay names may be recognizably abbreviated.
X.PP
X.I time
Xis a standard time specification, like ``12:05'' or ``3AM''
X.PP
X.I interval
Xis a colon separated list of signed integer offsets from the
Xevent
X.I time
Xthe
X.I command
Xwill be executed.  Negative values are before the event, 0 at the event,
Xand positive values later.
X.PP
X.I command
Xis a string up to a newline that will be executed by
X.I system(3)
Xon your behalf at the specified
X.I interval
Xuntil you shut it up with
X.I okok.
X.PP
XSome shell variables are set for use by the command:
X.br
X.B pretime
Xis set to the -interval.
X.br
X.B posttime
Xis set to the interval.
X.br
X.B now
Xis set to an hh:mm string of the present time, in 24 hour format.
X.br
X.B then
Xis set to an hh:mm string of the event time.
X.PP
X.I okok
Xshuts up the the nagging.  It opens the terminal and prompts with the
Xcommand(s) nearing their times, like rm -i.  Answering `y' silences
Xfurther executions of the command.  It does this by editing the .nag
Xfile, which is noticed by any running
X.I nag
Xprocesses the next time they wake up.
X.PP
XWhen a silenced event is past it's last possible occurrance,
X.I nag
Xre\-enables it by writing the .nag file.  This makes `*' reminders
Xwork the next day.
X
X.SH EXAMPLES
XA .nag file might have the following entries:
X.PP
X.br
X 8/8/88 2PM -60:-30:-15:0 writebig "$pretime to Client call at $then"
X.br
X Mon 3PM -60:-30:-15:0 hey "Status report due in $pretime minutes"
X.br
X Wed 3:30PM -30:-15:-5:0 echo "Committee at $then in $pretime minutes"
X.br
X * 13:00 -45:-30:0 writebig "Lunch in $pretime minutes"
X.br
X * 7PM -5:-4:-3:-2:-1:0 echo "GO HOME!!! It's $now"
X.br
X * 10:30 -10:-5:0 echo "Donut truck in $pretime minutes"
X.SH FILES
X.ta 2i
X.B ~/.nag	file describing things to do.
X.SH ENVIRONMENT
X.br
X.B NAGFILE	a file to use as the nagfile instead of ~/.nag
X.SH "SEE ALSO"
Xat(1),
Xcalendar(1),
Xhey(1),
Xleave(1),
Xsleep(1),
Xcron(8)
X.SH DIAGNOSTICS
XComplains about various syntax errors and times out of range, and problems
Xaccessing .nag file
X.SH BUGS
X.PP
XProbably won't work with `stty nostop' set.
X.PP
XIntervals will be approximate because of sleep granularity and scheduling
Xcontention.
X.PP
XThere is no locking of the .nag file.  This could be trouble if a
X.I nag
Xand an
X.I okok
Xdecide to write at the same time.
X.SH AUTHOR
XDavid Brower
X.br
X{sun, cbosgd, amdahl, mtxinu}!rtech!gonzo!daveb
X
X
SHAR_EOF
if test 3319 -ne "`wc -c 'nag.1'`"
then
	echo shar: error transmitting "'nag.1'" '(should have been 3319 characters)'
fi
echo shar: extracting "'Makefile'" '(619 characters)'
if test -f 'Makefile'
then
	echo shar: over-writing existing file "'Makefile'"
fi
sed 's/^X//' << \SHAR_EOF > 'Makefile'
X#
X# Makefile for the nag/okok system.
X#
X
XSHAR1 =		README nag.1 Makefile 
XSHAR2 =		$(SRCS)
X
X# -DSYS5 for System V, nothing for BSD.
XDEFS =		# -DSYS5
XOPTDEB =	-O
XCFLAGS =	$(DEFS) $(OPTDEB)
XOBJS =		gdate.o nag.o
XSRCS =		gdate.c nag.c
X
Xall:		nag okok
X
Xclean:;		rm -f $(OBJS) nag okok gdate OUT LINT a.out core
X
Xnag:		$(OBJS)
X		cc -g -o nag $(OBJS)
X
Xokok:		nag
X		ln nag okok
X
Xgdate:		gdate.c
X		cc -DDEBUG $(CFLAGS) gdate.c -o gdate
X
Xlint:		LINT
X
XLINT:		$(SRCS)
X		lint $(DEFS) $(SRCS) > LINT
X
Xshar:		nag1.shar nag2.shar
X
Xnag1.shar:	$(SHAR1)
X		shar -a $(SHAR1) > nag1.shar
X
Xnag2.shar:	$(SHAR2)
X		shar -a $(SHAR2) > nag2.shar
X
SHAR_EOF
if test 619 -ne "`wc -c 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 619 characters)'
fi
#	End of shell archive
exit 0



More information about the Mod.sources mailing list