| 1052 |
|
register PROC *pp; |
| 1053 |
|
|
| 1054 |
|
pp = ps->proc + pn; |
| 1055 |
– |
if (!silent) { /* echo command */ |
| 1056 |
– |
if (ps->hostname[0]) |
| 1057 |
– |
printf("On %s:", ps->hostname); |
| 1058 |
– |
printf("\t%s\n", pp->com); |
| 1059 |
– |
fflush(stdout); |
| 1060 |
– |
} |
| 1055 |
|
if (pp->elen) { /* pass errors */ |
| 1056 |
+ |
if (ps->hostname[0]) |
| 1057 |
+ |
fprintf(stderr, "%s: ", ps->hostname); |
| 1058 |
+ |
fprintf(stderr, "Error output from: %s\n", pp->com); |
| 1059 |
|
fputs(pp->errs, stderr); |
| 1060 |
|
fflush(stderr); |
| 1061 |
|
if (ps->hostname[0]) |
| 1092 |
|
int pid; |
| 1093 |
|
register struct pslot *psl; |
| 1094 |
|
|
| 1095 |
< |
if (noaction) { |
| 1096 |
< |
if (!silent) |
| 1097 |
< |
printf("\t%s\n", com); /* just echo it */ |
| 1095 |
> |
if (!silent) |
| 1096 |
> |
printf("\t%s &\n", com); /* echo command */ |
| 1097 |
> |
if (noaction) |
| 1098 |
|
return(0); |
| 1099 |
< |
} |
| 1099 |
> |
fflush(stdout); |
| 1100 |
|
/* else start it when we can */ |
| 1101 |
|
while ((pid = startjob(NULL, savestr(com), donecom)) == -1) |
| 1102 |
|
bwait(1); |
| 1103 |
+ |
if (!silent) { |
| 1104 |
+ |
PSERVER *ps; |
| 1105 |
+ |
int psn = pid; |
| 1106 |
+ |
ps = findpjob(&psn); |
| 1107 |
+ |
printf("\tProcess started on %s\n", |
| 1108 |
+ |
ps->hostname[0] ? ps->hostname : LHOSTNAME); |
| 1109 |
+ |
fflush(stdout); |
| 1110 |
+ |
} |
| 1111 |
|
psl = findpslot(pid); /* record info. in appropriate slot */ |
| 1112 |
|
psl->pid = pid; |
| 1113 |
|
psl->fout = fout; |
| 1148 |
|
int maxcopies; |
| 1149 |
|
{ |
| 1150 |
|
int retstatus = 0; |
| 1151 |
+ |
int hostcopies; |
| 1152 |
|
int status; |
| 1153 |
|
register PSERVER *ps; |
| 1154 |
|
|
| 1155 |
< |
if (noaction) { |
| 1156 |
< |
if (!silent) |
| 1157 |
< |
printf("\t%s\n", com); /* just echo */ |
| 1155 |
> |
if (!silent) |
| 1156 |
> |
printf("\t%s &\n", com); /* echo command */ |
| 1157 |
> |
if (noaction) |
| 1158 |
|
return(0); |
| 1159 |
< |
} |
| 1159 |
> |
fflush(stdout); |
| 1160 |
|
/* start jobs on each server */ |
| 1161 |
< |
for (ps = pslist; ps != NULL; ps = ps->next) |
| 1161 |
> |
for (ps = pslist; ps != NULL; ps = ps->next) { |
| 1162 |
> |
hostcopies = 0; |
| 1163 |
|
while (maxcopies > 0 && |
| 1164 |
|
startjob(ps, savestr(com), donecom) != -1) { |
| 1165 |
|
sleep(10); |
| 1166 |
+ |
hostcopies++; |
| 1167 |
|
maxcopies--; |
| 1168 |
|
} |
| 1169 |
+ |
if (!silent && hostcopies) { |
| 1170 |
+ |
if (hostcopies > 1) |
| 1171 |
+ |
printf("\t%d duplicate processes", hostcopies); |
| 1172 |
+ |
else |
| 1173 |
+ |
printf("\tProcess"); |
| 1174 |
+ |
printf(" started on %s\n", |
| 1175 |
+ |
ps->hostname[0] ? ps->hostname : LHOSTNAME); |
| 1176 |
+ |
fflush(stdout); |
| 1177 |
+ |
} |
| 1178 |
+ |
} |
| 1179 |
|
/* wait for jobs to finish */ |
| 1180 |
|
while ((status = wait4job(NULL, -1)) != -1) |
| 1181 |
|
if (status) |