hostname = as->parms[0].items->data;
th = hostutil_GetHostByName(hostname);
if (!th) {
- printf("bos: can't find address for host '%s'\n", hostname);
+ fprintf(stderr, "bos: can't find address for host '%s'\n", hostname);
exit(1);
}
memcpy(&addr, th->h_addr, sizeof(afs_int32));
* directory */
tdir = afsconf_Open(confdir);
if (tdir == NULL) {
- printf("bos: can't open cell database (%s)\n", confdir);
+ fprintf(stderr, "bos: can't open cell database (%s)\n", confdir);
exit(1);
}
}
else if (strcmp(tp, "off") == 0)
flag = 1;
else {
- printf
- ("bos: illegal authentication specifier '%s', must be 'off' or 'on'.\n",
+ fprintf
+ (stderr, "bos: illegal authentication specifier '%s', must be 'off' or 'on'.\n",
tp);
return 1;
}
tconn = GetConn(as, 0);
code = BOZO_Exec(tconn, as->parms[1].items->data);
if (code)
- printf("bos: failed to execute command (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to execute command (%s)\n", em(code));
return code;
}
tconn = GetConn(as, 0);
if (!as->parms[1].items) {
- printf("bos: no files to check\n");
+ fprintf(stderr, "bos: no files to check\n");
return 1;
}
ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
code = BOZO_GetDates(tconn, tbuffer, &time, &bakTime, &oldTime);
if (code) {
- printf("bos: failed to check date on %s (%s)\n", ti->data,
+ fprintf(stderr, "bos: failed to check date on %s (%s)\n", ti->data,
em(code));
return 1;
} else {
tconn = GetConn(as, 0);
if (!as->parms[1].items) {
- printf("bos: no files to uninstall\n");
+ fprintf(stderr, "bos: no files to uninstall\n");
return 1;
}
ComputeDestDir(ti->data, destDir, tbuffer, sizeof(tbuffer));
code = BOZO_UnInstall(tconn, tbuffer);
if (code) {
- printf("bos: failed to uninstall %s (%s)\n", ti->data, em(code));
+ fprintf(stderr, "bos: failed to uninstall %s (%s)\n", ti->data, em(code));
return 1;
} else
printf("bos: uninstalled file %s\n", ti->data);
tp = buffer;
code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
if (code) {
- printf("bos: failed to get instance info for '%s' (%s)\n", aname,
+ fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
em(code));
/* if we can't get the answer, assume its running */
return BSTAT_NORMAL;
tconn = GetConn(as, 0);
if (!as->parms[1].items) {
- printf("bos: no files to install\n");
+ fprintf(stderr, "bos: no files to install\n");
return 1;
}
fd = open(ti->data, O_RDONLY);
if (fd < 0) {
/* better to quit on error than continue for install command */
- printf("bos: can't find file '%s', quitting\n", ti->data);
+ fprintf(stderr, "bos: can't find file '%s', quitting\n", ti->data);
return 1;
}
code = fstat(fd, &tstat);
if (code) {
- printf("bos: failed to stat file %s, errno is %d\n", ti->data,
+ fprintf(stderr, "bos: failed to stat file %s, errno is %d\n", ti->data,
errno);
return 1;
}
}
code = rx_EndCall(tcall, code);
if (code) {
- printf("bos: failed to install %s (%s)\n", ti->data, em(code));
+ fprintf(stderr, "bos: failed to install %s (%s)\n", ti->data, em(code));
return 1;
} else
printf("bos: installed file %s\n", ti->data);
if (as->parms[1].items == 0) {
code = BOZO_ShutdownAll(tconn);
if (code)
- printf("bos: failed to shutdown servers (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to shutdown servers (%s)\n", em(code));
} else {
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_SetTStatus(tconn, ti->data, BSTAT_SHUTDOWN);
if (code)
- printf("bos: failed to shutdown instance %s (%s)\n", ti->data,
+ fprintf(stderr, "bos: failed to shutdown instance %s (%s)\n", ti->data,
em(code));
}
}
if (as->parms[8].items) {
code = BOZO_WaitAll(tconn);
if (code)
- printf("bos: can't wait for processes to shutdown (%s)\n",
+ fprintf(stderr, "bos: can't wait for processes to shutdown (%s)\n",
em(code));
}
return 0;
code = BOZO_GetRestartTime(tconn, 1, (struct bozo_netKTime *) &generalTime);
if (code) {
- printf("bos: failed to retrieve restart information (%s)\n",
+ fprintf(stderr, "bos: failed to retrieve restart information (%s)\n",
em(code));
return code;
}
code = BOZO_GetRestartTime(tconn, 2, (struct bozo_netKTime *) &newBinaryTime);
if (code) {
- printf("bos: failed to retrieve restart information (%s)\n",
+ fprintf(stderr, "bos: failed to retrieve restart information (%s)\n",
em(code));
return code;
}
code = ktime_DisplayString(&generalTime, messageBuffer);
if (code) {
- printf("bos: failed to decode restart time (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to decode restart time (%s)\n", em(code));
return code;
}
printf("Server %s restarts %s\n", hostp, messageBuffer);
code = ktime_DisplayString(&newBinaryTime, messageBuffer);
if (code) {
- printf("bos: failed to decode restart time (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to decode restart time (%s)\n", em(code));
return code;
}
printf("Server %s restarts for new binaries %s\n", hostp, messageBuffer);
type = 2;
}
if (count > 1) {
- printf("bos: can't specify more than one restart time at a time\n");
+ fprintf(stderr, "bos: can't specify more than one restart time at a time\n");
return -1;
}
if (count == 0)
type = 1; /* by default set general restart time */
if ((code = ktime_ParsePeriodic(as->parms[1].items->data, &restartTime))) {
- printf("bos: failed to parse '%s' as periodic restart time(%s)\n",
+ fprintf(stderr, "bos: failed to parse '%s' as periodic restart time(%s)\n",
as->parms[1].items->data, em(code));
return code;
}
code = BOZO_SetRestartTime(tconn, type, (struct bozo_netKTime *) &restartTime);
if (code) {
- printf("bos: failed to set restart time at server (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to set restart time at server (%s)\n", em(code));
return code;
}
return 0;
if (as->parms[1].items == 0) {
code = BOZO_StartupAll(tconn);
if (code)
- printf("bos: failed to startup servers (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to startup servers (%s)\n", em(code));
} else {
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_SetTStatus(tconn, ti->data, BSTAT_NORMAL);
if (code)
- printf("bos: failed to start instance %s (%s)\n", ti->data,
+ fprintf(stderr, "bos: failed to start instance %s (%s)\n", ti->data,
em(code));
}
}
if (as->parms[1].items) {
/* specified specific things to restart, can't do this at the same
* time */
- printf
- ("bos: can't specify both '-bos' and specific servers to restart.\n");
+ fprintf
+ (stderr, "bos: can't specify both '-bos' and specific servers to restart.\n");
return 1;
}
/* otherwise do a rebozo */
code = BOZO_ReBozo(tconn);
if (code)
- printf("bos: failed to restart bosserver (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to restart bosserver (%s)\n", em(code));
return code;
}
if (as->parms[1].items == 0) {
if (as->parms[3].items) { /* '-all' */
code = BOZO_RestartAll(tconn);
if (code)
- printf("bos: failed to restart servers (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to restart servers (%s)\n", em(code));
} else
- printf("bos: To restart all processes please specify '-all'\n");
+ fprintf(stderr, "bos: To restart all processes please specify '-all'\n");
} else {
if (as->parms[3].items) {
- printf("bos: Can't use '-all' along with individual instances\n");
+ fprintf(stderr, "bos: Can't use '-all' along with individual instances\n");
} else {
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_Restart(tconn, ti->data);
if (code)
- printf("bos: failed to restart instance %s (%s)\n",
+ fprintf(stderr, "bos: failed to restart instance %s (%s)\n",
ti->data, em(code));
}
}
tconn = GetConn(as, 0);
code = BOZO_SetCellName(tconn, as->parms[1].items->data);
if (code)
- printf("bos: failed to set cell (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to set cell (%s)\n", em(code));
return 0;
}
} else
code = BOZO_AddCellHost(tconn, ti->data);
if (code)
- printf("bos: failed to add host %s (%s)\n", ti->data, em(code));
+ fprintf(stderr, "bos: failed to add host %s (%s)\n", ti->data, em(code));
}
return 0;
}
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_DeleteCellHost(tconn, ti->data);
if (code)
- printf("bos: failed to delete host %s (%s)\n", ti->data,
+ fprintf(stderr, "bos: failed to delete host %s (%s)\n", ti->data,
em(code));
}
return 0;
tconn = GetConn(as, 0);
code = BOZO_GetCellName(tconn, &tp);
if (code) {
- printf("bos: failed to get cell name (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to get cell name (%s)\n", em(code));
exit(1);
}
printf("Cell name is %s\n", tbuffer);
if (code == BZDOM)
break;
if (code != 0) {
- printf("bos: failed to get cell host %d (%s)\n", i, em(code));
+ fprintf(stderr, "bos: failed to get cell host %d (%s)\n", i, em(code));
exit(1);
}
printf(" Host %d is %s\n", i + 1, tbuffer);
}
code = BOZO_AddKey(tconn, temp, ktc_to_bozoptr(&tkey));
if (code) {
- printf("bos: failed to set key %d (%s)\n", temp, em(code));
+ fprintf(stderr, "bos: failed to set key %d (%s)\n", temp, em(code));
exit(1);
}
return 0;
temp = atoi(ti->data);
code = BOZO_DeleteKey(tconn, temp);
if (code) {
- printf("bos: failed to delete key %d (%s)\n", temp, em(code));
+ fprintf(stderr, "bos: failed to delete key %d (%s)\n", temp, em(code));
exit(1);
}
}
printf("Keys last changed on %s.\n", DateOf(keyInfo.mod_sec));
}
if (code != BZDOM)
- printf("bos: %s error encountered while listing keys\n", em(code));
+ fprintf(stderr, "bos: %s error encountered while listing keys\n", em(code));
else
printf("All done.\n");
return 0;
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_AddSUser(tconn, ti->data);
if (code) {
- printf("bos: failed to add user '%s' (%s)\n", ti->data, em(code));
+ fprintf(stderr, "bos: failed to add user '%s' (%s)\n", ti->data, em(code));
failed = 1;
}
}
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_DeleteSUser(tconn, ti->data);
if (code) {
- printf("bos: failed to delete user '%s', ", ti->data);
+ fprintf(stderr, "bos: failed to delete user '%s', ", ti->data);
if (code == ENOENT)
- printf("(no such user)\n");
+ fprintf(stderr, "(no such user)\n");
else
- printf("(%s)\n", em(code));
+ fprintf(stderr, "(%s)\n", em(code));
failed = 1;
}
}
}
if (code != 1) {
/* a real error code, instead of scanned past end */
- printf("bos: failed to retrieve super-user list (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to retrieve super-user list (%s)\n", em(code));
return code;
}
if (lastNL == 0)
if (code == BZDOM)
break;
if (code) {
- printf("bos: failed to contact host's bosserver (%s).\n",
+ fprintf(stderr, "bos: failed to contact host's bosserver (%s).\n",
em(code));
break;
}
BOZO_CreateBnode(tconn, type, name, parms[0], parms[1], parms[2],
parms[3], parms[4], notifier);
if (code) {
- printf
- ("bos: failed to create new server instance %s of type '%s' (%s)\n",
+ fprintf
+ (stderr, "bos: failed to create new server instance %s of type '%s' (%s)\n",
name, type, em(code));
}
return code;
code = BOZO_DeleteBnode(tconn, ti->data);
if (code) {
if (code == BZBUSY)
- printf("bos: can't delete running instance '%s'\n", ti->data);
+ fprintf(stderr, "bos: can't delete running instance '%s'\n", ti->data);
else
- printf("bos: failed to delete instance '%s' (%s)\n", ti->data,
+ fprintf(stderr, "bos: failed to delete instance '%s' (%s)\n", ti->data,
em(code));
}
}
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_SetStatus(tconn, ti->data, BSTAT_NORMAL);
if (code)
- printf("bos: failed to start instance '%s' (%s)\n", ti->data,
- em(code));
+ fprintf(stderr, "bos: failed to start instance '%s' (%s)\n",
+ ti->data, em(code));
}
return code;
}
for (ti = as->parms[1].items; ti; ti = ti->next) {
code = BOZO_SetStatus(tconn, ti->data, BSTAT_SHUTDOWN);
if (code)
- printf("bos: failed to change stop instance '%s' (%s)\n",
+ fprintf(stderr, "bos: failed to change stop instance '%s' (%s)\n",
ti->data, em(code));
}
if (as->parms[8].items) {
code = BOZO_WaitAll(tconn);
if (code)
- printf("bos: can't wait for processes to shutdown (%s)\n",
+ fprintf(stderr, "bos: can't wait for processes to shutdown (%s)\n",
em(code));
}
return code;
if (aparm1) {
partNumber = volutil_GetPartitionID(aparm1);
if (partNumber < 0) {
- printf("bos: could not parse partition ID '%s'\n", aparm1);
+ fprintf(stderr, "bos: could not parse partition ID '%s'\n", aparm1);
return EINVAL;
}
tp = volutil_PartitionName(partNumber);
if (!tp) {
- printf("bos: internal error parsing partition ID '%s'\n", aparm1);
+ fprintf(stderr, "bos: internal error parsing partition ID '%s'\n", aparm1);
return EINVAL;
}
strcpy(partName, tp);
if (aoutName) {
outFile = fopen(aoutName, "w");
if (!outFile) {
- printf("bos: can't open specified SalvageLog file '%s'\n",
+ fprintf(stderr, "bos: can't open specified SalvageLog file '%s'\n",
aoutName);
return ENOENT;
}
if ((strlen(tbuffer) + 9 + strlen(partName) + 1 + strlen(aparm2) +
1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
if ((strlen(tbuffer) + 1 + strlen(partName) + 1 + strlen(aparm2) +
1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
/* partition salvage */
strncpy(tbuffer, AFSDIR_CANONICAL_SERVER_SALVAGER_FILEPATH, BOZO_BSSIZE);
if ((strlen(tbuffer) + 4 + strlen(partName) + 1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
strcat(tbuffer, " -force ");
/* add the parallel option if given */
if (parallel != NULL) {
if ((strlen(tbuffer) + 11 + strlen(parallel) + 1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
strcat(tbuffer, " -parallel ");
/* add the tmpdir option if given */
if (atmpDir != NULL) {
if ((strlen(tbuffer) + 9 + strlen(atmpDir) + 1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
strcat(tbuffer, " -tmpdir ");
/* add the orphans option if given */
if (orphans != NULL) {
if ((strlen(tbuffer) + 10 + strlen(orphans) + 1) > BOZO_BSSIZE) {
- printf("bos: command line too big\n");
+ fprintf(stderr, "bos: command line too big\n");
return (E2BIG);
}
strcat(tbuffer, " -orphans ");
BOZO_CreateBnode(aconn, "cron", "salvage-tmp", parms[0], parms[1],
parms[2], parms[3], parms[4], notifier);
if (code) {
- printf("bos: failed to start 'salvager' (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to start 'salvager' (%s)\n", em(code));
goto done;
}
/* now wait for bnode to disappear */
printf("bos: waiting for salvage to complete.\n");
}
if (code != BZNOENT) {
- printf("bos: salvage failed (%s)\n", em(code));
+ fprintf(stderr, "bos: salvage failed (%s)\n", em(code));
goto done;
}
code = 0;
/* we can do a volume, a partition or the whole thing, but not mixtures
* thereof */
if (!as->parms[1].items && as->parms[2].items) {
- printf("bos: must specify partition to salvage individual volume.\n");
+ fprintf(stderr, "bos: must specify partition to salvage individual volume.\n");
return -1;
}
if (as->parms[5].items && as->parms[3].items) {
return -1;
}
if (as->parms[4].items && (as->parms[1].items || as->parms[2].items)) {
- printf("bos: can not specify -all with other flags.\n");
+ fprintf(stderr, "bos: can not specify -all with other flags.\n");
return -1;
}
if (dafs) {
if (!as->parms[9].items) { /* -forceDAFS flag */
- printf("This is a demand attach fileserver. Are you sure you want to proceed with a manual salvage?\n");
- printf("must specify -forceDAFS flag in order to proceed.\n");
+ fprintf(stderr, "This is a demand attach fileserver. Are you sure you want to proceed with a manual salvage?\n");
+ fprintf(stderr, "must specify -forceDAFS flag in order to proceed.\n");
return EINVAL;
}
}
printf("bos: shutting down '%s'.\n", serviceName);
code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
if (code) {
- printf("bos: failed to stop '%s' (%s)\n", serviceName, em(code));
+ fprintf(stderr, "bos: failed to stop '%s' (%s)\n", serviceName, em(code));
return code;
}
code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
if (code)
- printf
- ("bos: failed to wait for file server shutdown, continuing.\n");
+ fprintf
+ (stderr, "bos: failed to wait for file server shutdown, continuing.\n");
}
/* now do the salvage operation */
printf("Starting salvage.\n");
printf("bos: restarting %s.\n", serviceName);
code = BOZO_SetTStatus(tconn, serviceName, BSTAT_NORMAL);
if (code) {
- printf("bos: failed to restart '%s' (%s)\n", serviceName, em(code));
+ fprintf(stderr, "bos: failed to restart '%s' (%s)\n", serviceName, em(code));
return code;
}
}
return rc;
} else if (!as->parms[2].items) {
if (!as->parms[1].items) {
- printf
- ("bos: must specify -all switch to salvage all partitions.\n");
+ fprintf
+ (stderr, "bos: must specify -all switch to salvage all partitions.\n");
return -1;
}
if (volutil_GetPartitionID(as->parms[1].items->data) < 0) {
/* can't parse volume ID, so complain before shutting down
* file server.
*/
- printf("bos: can't interpret %s as partition ID.\n",
+ fprintf(stderr, "bos: can't interpret %s as partition ID.\n",
as->parms[1].items->data);
return -1;
}
printf("bos: shutting down '%s'.\n", serviceName);
code = BOZO_SetTStatus(tconn, serviceName, BSTAT_SHUTDOWN);
if (code) {
- printf("bos: can't stop '%s' (%s)\n", serviceName, em(code));
+ fprintf(stderr, "bos: can't stop '%s' (%s)\n", serviceName, em(code));
return code;
}
code = BOZO_WaitAll(tconn); /* wait for shutdown to complete */
if (code)
- printf
- ("bos: failed to wait for file server shutdown, continuing.\n");
+ fprintf
+ (stderr, "bos: failed to wait for file server shutdown, continuing.\n");
}
/* now do the salvage operation */
printf("Starting salvage.\n");
if (code == 0) {
newID = vsu_GetVolumeID(as->parms[2].items->data, cstruct, &err);
if (newID == 0) {
- printf("bos: can't interpret %s as volume name or ID\n",
+ fprintf(stderr, "bos: can't interpret %s as volume name or ID\n",
as->parms[2].items->data);
return -1;
}
sprintf(tname, "%u", newID);
} else {
- printf
- ("bos: can't initialize volume system client (code %d), trying anyway.\n",
+ fprintf
+ (stderr, "bos: can't initialize volume system client (code %d), trying anyway.\n",
code);
strncpy(tname, as->parms[2].items->data, sizeof(tname));
}
/* can't parse volume ID, so complain before shutting down
* file server.
*/
- printf("bos: can't interpret %s as partition ID.\n",
+ fprintf(stderr, "bos: can't interpret %s as partition ID.\n",
as->parms[1].items->data);
return -1;
}
tp = buffer;
code = BOZO_GetInstanceInfo(aconn, aname, &tp, &istatus);
if (code) {
- printf("bos: failed to get instance info for '%s' (%s)\n", aname,
+ fprintf(stderr, "bos: failed to get instance info for '%s' (%s)\n", aname,
em(code));
return -1;
}
tp = buffer;
code = BOZO_GetStatus(aconn, aname, &temp, &tp);
if (code)
- printf("bos: failed to get status for instance '%s' (%s)\n", aname,
+ fprintf(stderr, "bos: failed to get status for instance '%s' (%s)\n", aname,
em(code));
else {
printf("currently ");
tconn = GetConn(as, 0);
code = BOZO_GetRestrictedMode(tconn, &val);
if (code)
- printf("bos: failed to get restricted mode (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to get restricted mode (%s)\n", em(code));
else
printf("Restricted mode is %s\n", val ? "on" : "off");
util_GetInt32(as->parms[1].items->data, &val);
code = BOZO_SetRestrictedMode(tconn, val);
if (code)
- printf("bos: failed to set restricted mode (%s)\n", em(code));
+ fprintf(stderr, "bos: failed to set restricted mode (%s)\n", em(code));
return 0;
}
/* start up rx */
code = rx_Init(0);
if (code) {
- printf("bos: could not initialize rx (%s)\n", em(code));
+ fprintf(stderr, "bos: could not initialize rx (%s)\n", em(code));
exit(1);
}