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();
87 if ((whoami = rindex(argv[0], '/')) == NULL)
96 status = sms_connect(SMS_SERVER);
98 (void) sprintf(buf, "\nConnection to the SMS server failed.");
102 status = sms_auth("smscheck");
104 (void) sprintf(buf, "\nAuthorization failure -- run \"kinit\" \
109 services = sq_create();
110 args[0] = args[2] = "TRUE";
111 args[1] = "DONTCARE";
112 if ((status = sms_query("qualified_get_server", 3, args, save_args,
113 (char *)services)) &&
114 status != SMS_NO_MATCH)
115 com_err(whoami, status, " while getting servers");
119 args[1] = args[5] = "TRUE";
120 args[2] = args[3] = args[4] = "DONTCARE";
121 if ((status = sms_query("qualified_get_server_host", 6, args, save_args,
123 status != SMS_NO_MATCH)
124 com_err(whoami, status, " while getting server/hosts");
126 while (sq_get_data(services, &service)) {
128 if (status = sms_query("get_server_info", 1, service, gserv, NULL))
129 com_err(whoami, status, " while getting info about service %s",
133 while (sq_get_data(hosts, &host)) {
135 if (status = sms_query("get_server_host_info", 2, host, ghost, NULL))
136 com_err(whoami, status, " while getting info about host %s:%s",
141 strcpy(buf, "Nothing has failed at this time");
143 sprintf(buf, "%d thing%s ha%s failed at this time", count,
144 count == 1 ? "" : "s", count == 1 ? "s" : "ve");
151 com_err(whoami, status, buf);
159 com_err(whoami, status, "Update to SMS returned a value -- \
160 programmer botch.\n");
167 fprintf(stderr, "Usage: %s\n", whoami);