2 * Verify that all SMS updates are successful
4 * Copyright 1988 by the Massachusetts Institute of Technology. For copying
5 * and distribution information, see the file "mit-copyright.h".
13 static char *rcsid_chsh_c = "$Header$";
19 #include "mit-copyright.h"
21 char *malloc(), *rindex(), *strsave();
42 struct save_queue *sq;
46 tmp = strsave(atot(argv[4]));
47 printf("Service %s, error %s: %s\n\tlast success %s, last try %s\n",
48 argv[0], argv[9], argv[10], tmp, atot(argv[5]));
56 struct save_queue *sq;
60 tmp = strsave(atot(argv[9]));
61 printf("Host %s:%s, error %s: %s\n\tlast success %s, last try %s\n",
62 argv[0], argv[1], argv[6], argv[7], tmp, atot(argv[8]));
67 save_args(argc, argv, sq)
70 struct save_queue *sq;
72 sq_save_args(argc, argv, sq);
80 char *args[6], buf[BUFSIZ], **service, **host;
81 struct save_queue *services, *hosts;
82 int count = 0, scream();
84 if ((whoami = rindex(argv[0], '/')) == NULL)
93 status = sms_connect(SMS_SERVER);
95 (void) sprintf(buf, "\nConnection to the SMS server failed.");
99 status = sms_auth("smscheck");
101 (void) sprintf(buf, "\nAuthorization failure -- run \"kinit\" \
106 services = sq_create();
107 args[0] = args[2] = "TRUE";
108 args[1] = "DONTCARE";
109 if ((status = sms_query("qualified_get_server", 3, args, save_args,
110 (char *)services)) &&
111 status != SMS_NO_MATCH)
112 com_err(whoami, status, " while getting servers");
116 args[1] = args[5] = "TRUE";
117 args[2] = args[3] = args[4] = "DONTCARE";
118 if ((status = sms_query("qualified_get_server_host", 6, args, save_args,
120 status != SMS_NO_MATCH)
121 com_err(whoami, status, " while getting server/hosts");
123 while (sq_get_data(services, &service)) {
125 if (status = sms_query("get_server_info", 1, service, gserv, NULL))
126 com_err(whoami, status, " while getting info about service %s",
130 while (sq_get_data(hosts, &host)) {
132 if (status = sms_query("get_server_host_info", 2, host, ghost, NULL))
133 com_err(whoami, status, " while getting info about host %s:%s",
138 strcpy(buf, "Nothing has failed at this time");
140 sprintf(buf, "%d thing%s ha%s failed at this time", count,
141 count == 1 ? "" : "s", count == 1 ? "s" : "ve");
148 com_err(whoami, status, buf);
156 com_err(whoami, status, "Update to SMS returned a value -- \
157 programmer botch.\n");
164 fprintf(stderr, "Usage: %s\n", whoami);