]> andersk Git - moira.git/blobdiff - lib/critical.c
#define the zephyr stuff & add syslog definitions as well
[moira.git] / lib / critical.c
index 3e84ad21c5ab443db8b5866d73c5fe159770e78c..c3502e036d4e73db9f2c06c89e305c246627e7af 100644 (file)
@@ -1,19 +1,34 @@
 /* $Header$
  *
  * Log and send a zephyrgram about any critical errors.
+ *
+ *  (c) Copyright 1988 by the Massachusetts Institute of Technology.
+ *  For copying and distribution information, please see the file
+ *  <mit-copyright.h>.
  */
 
+/* At Athena, we use zephyr & not syslog.  Change the following line 
+ * if necessary */
+#define ZEPHYR
+
+
+#include <mit-copyright.h>
 #include <stdio.h>
 #include <sys/file.h>
+#ifdef ZEPHYR
 #include <zephyr/zephyr.h>
+#endif
+#ifdef SYSLOG
+#include <syslog.h>
+#endif
+#include <sms_app.h>
 
 
-/* log file for critical events that require human intervention */
-#define CRITERRLOG     "/u1/sms/critical.log"
-
 /* mode to create the file with */
 #define LOGFILEMODE    0644
 
+extern char *whoami;
+
 
 void critical_alert(instance, msg, args)
   char *instance;              /* Instance for zephyr gram */
@@ -67,6 +82,7 @@ send_zgram(inst, msg)
 char *inst;
 char *msg;
 {
+#ifdef ZEPHYR
     ZNotice_t znotice;
 
     bzero (&znotice, sizeof (znotice));
@@ -80,4 +96,12 @@ char *msg;
     znotice.z_opcode = "";
     znotice.z_recipient = "";
     ZSendNotice(&znotice, ZNOAUTH);
+#endif
+#ifdef SYSLOG
+    {
+       char buf[512];
+       sprintf(buf, "SMS: %s %s", inst, msg);
+       syslog(LOG_ERR, buf);
+    }
+#endif
 }
This page took 0.094267 seconds and 4 git commands to generate.