home *** CD-ROM | disk | FTP | other *** search
- From: art@pilikia.pegasus.com (Authur W. Neilson III)
- Newsgroups: comp.sources.misc
- Subject: v18i015: upsd - UPS monitor daemon, Patch02
- Message-ID: <1991Apr12.034835.4780@sparky.IMD.Sterling.COM>
- Date: 12 Apr 91 03:48:35 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: 3a78d849 08f863c5 12d9372d 306147ce
-
- Submitted-by: Authur W. Neilson III <art@pilikia.pegasus.com>
- Posting-number: Volume 18, Issue 15
- Archive-name: upsd/patch02
- Patch-To: upsd: Volume 18, Issue 5
-
- This is an update to the UPS monitor daemon. This patch adds logfile
- locking and allows only 1 upsd to be running at a time. Other minor
- cleanups were also done. Unshar this patch then apply this set
- of context diffs to upsd patchlevel 1 via Larry Wall's "patch" utility
- like this:
- patch < Patch02
- Art
- -----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: Patch02
- # Wrapped by kent@sparky on Thu Apr 11 22:42:00 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive."'
- if test -f 'Patch02' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Patch02'\"
- else
- echo shar: Extracting \"'Patch02'\" \(2727 characters\)
- sed "s/^X//" >'Patch02' <<'END_OF_FILE'
- X*** HISTORY.orig Thu Apr 11 08:11:34 1991
- X--- HISTORY Thu Apr 11 08:15:12 1991
- X***************
- X*** 1,7 ****
- X! RELEASE HISTORY
- X
- X Date Release Patch Description
- X -------------------------------------------------------------------------------
- X! 03/30/91 1.0 0 Initial release to net
- X 04/09/91 1.0 1 Fixed stupidity with ups_time alarm setting and
- X! added version stuff
- X--- 1,9 ----
- X! UPSD RELEASE HISTORY art@pilikia.pegasus.com
- X
- X Date Release Patch Description
- X -------------------------------------------------------------------------------
- X! 03/30/91 1.0 0 Initial release to net.
- X 04/09/91 1.0 1 Fixed stupidity with ups_time alarm setting and
- X! added version stuff.
- X! 04/10/91 1.0 2 Added log file locking, only 1 upsd can be running
- X! now. Also added date to version string.
- X*** common.h.orig Thu Apr 11 08:11:34 1991
- X--- common.h Thu Apr 11 08:15:12 1991
- X***************
- X*** 12,17 ****
- X--- 12,18 ----
- X #include <string.h>
- X #include <fcntl.h>
- X #include <time.h>
- X+ #include <unistd.h>
- X #include <sys/types.h>
- X #include <sys/termio.h>
- X #include <sys/signal.h>
- X*** funcs.c.orig Thu Apr 11 08:11:35 1991
- X--- funcs.c Thu Apr 11 08:15:12 1991
- X***************
- X*** 153,158 ****
- X--- 153,162 ----
- X if ((log_fd = open(ups_log, LOG_FLAGS, LOG_PERMS)) == ERR)
- X exit(1);
- X
- X+ /* and advisory lock it */
- X+ if (lockf(log_fd, F_TLOCK, 0L) == ERR)
- X+ exit(1);
- X+
- X writelog(START_MSG);
- X
- X /* open blocks on UPS switch to battery */
- X***************
- X*** 292,301 ****
- X {
- X char *basename();
- X
- X! /* display version if foreground */
- X if (signal(SIGINT, SIG_IGN) != SIG_IGN)
- X! fprintf(stderr, "%s v%d.%d patchlevel %d\n", basename(s),
- X! RELEASE, REVISION, PATCHLEVEL);
- X }
- X
- X /*
- X--- 296,306 ----
- X {
- X char *basename();
- X
- X! /* display version in foreground */
- X if (signal(SIGINT, SIG_IGN) != SIG_IGN)
- X! fprintf(stderr, "%s release %s version %d.%d patchlevel %d\n",
- X! basename(s), RELEASE_DATE, RELEASE, REVISION,
- X! PATCHLEVEL);
- X }
- X
- X /*
- X*** ups.orig Thu Apr 11 08:11:35 1991
- X--- ups Thu Apr 11 08:15:12 1991
- X***************
- X*** 10,14 ****
- X set `who -r`
- X if [ $9 = "S" -a -x /etc/upsd ]
- X then
- X! /etc/upsd
- X fi
- X--- 10,14 ----
- X set `who -r`
- X if [ $9 = "S" -a -x /etc/upsd ]
- X then
- X! /etc/upsd &
- X fi
- X*** version.h.orig Thu Apr 11 08:11:35 1991
- X--- version.h Thu Apr 11 08:15:12 1991
- X***************
- X*** 11,14 ****
- X #define RELEASE_DATE "03/30/91"
- X #define RELEASE 1
- X #define REVISION 0
- X! #define PATCHLEVEL 1
- X--- 11,14 ----
- X #define RELEASE_DATE "03/30/91"
- X #define RELEASE 1
- X #define REVISION 0
- X! #define PATCHLEVEL 2
- END_OF_FILE
- if test 2727 -ne `wc -c <'Patch02'`; then
- echo shar: \"'Patch02'\" unpacked with wrong size!
- fi
- # end of 'Patch02'
- fi
- echo shar: End of archive.
- exit 0
- ----
- Arthur W. Neilson III | INET: art@pilikia.pegasus.com
- Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!pilikia!art
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-