00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <SUM.h>
00013 #include <soi_key.h>
00014 #include <rpc/rpc.h>
00015 #include <sum_rpc.h>
00016
00017 void usage()
00018 {
00019 printf("Send a SUMREPARTN message to all sum processes.\n");
00020 printf("This causes each sum process to call DS_PavailRequest2()\n");
00021 printf("which will set internal tables to a new read of the\n");
00022 printf("sum_partn_avail table in the sums DB.\n");
00023 printf("Formerly, the sums would need to be restarted for a table change to take effect.\n\n");
00024 printf("Usage: sumrepartn [-h] [-y]\n");
00025 printf(" y = Don't ask yes/no. Force yes.\n");
00026 exit(0);
00027 }
00028
00029 int main(int argc, char *argv[])
00030 {
00031 SUM_t *sum;
00032 char line[32];
00033 int status, c;
00034 int yes=0;
00035
00036 while((--argc > 0) && ((*++argv)[0] == '-')) {
00037 while((c = *++argv[0])) {
00038 switch(c) {
00039 case 'h':
00040 usage();
00041 break;
00042 case 'y':
00043 yes = 1;;
00044 break;
00045 }
00046 }
00047 }
00048 if(!yes) {
00049 printf("Do you want SUMS to read a new sum_partn_avail table (yes/no) [no] = ");
00050 if(gets(line) == NULL) { exit(0); }
00051 if(strcmp(line, "yes")) { exit(0); }
00052 }
00053 if((sum = SUM_open(NULL, NULL, printf)) == 0) {
00054 printf("Failed on SUM_open()\n");
00055 exit(1);
00056 }
00057 printf("Opened with SUMS uid=%lu\n", sum->uid);
00058 if(status = SUM_repartn(sum, printf)) {
00059 printf("ERROR on call to SUM_repartn() API\n");
00060 }
00061 SUM_close(sum, printf);
00062 printf("Complete\n");
00063 }