2 # Copyright (c) 1996, Carnegie Mellon University
5 # See CMU_copyright.ph for use and distribution information
7 #: * bos.pm - Wrappers around BOS commands (basic overseer server)
8 #: * This module provides wrappers around the various bosserver
9 #: * commands, giving them a nice perl-based interface. Someday, they might
10 #: * talk to the servers directly instead of using 'bos', but not anytime
15 use OpenAFS::CMU_copyright;
16 use OpenAFS::util qw(:DEFAULT :afs_internal);
23 @EXPORT = qw(&AFS_bos_create &AFS_bos_addhost
24 &AFS_bos_addkey &AFS_bos_adduser
25 &AFS_bos_delete &AFS_bos_exec
26 &AFS_bos_getdate &AFS_bos_getlog
27 &AFS_bos_getrestart &AFS_bos_install
28 &AFS_bos_listhosts &AFS_bos_listkeys
29 &AFS_bos_listusers &AFS_bos_prune
30 &AFS_bos_removehost &AFS_bos_removekey
31 &AFS_bos_removeuser &AFS_bos_restart
32 &AFS_bos_salvage &AFS_bos_setauth
33 &AFS_bos_setcellname &AFS_bos_setrestart
34 &AFS_bos_shutdown &AFS_bos_start
35 &AFS_bos_startup &AFS_bos_status
36 &AFS_bos_stop &AFS_bos_uninstall);
38 #: AFS_bos_addhost($server, $host, [$clone], [$cell])
39 #: Add a new database server host named $host to the database
41 #: If $clone is specified, create an entry for a clone server.
42 #: On success, return 1.
44 $AFS_Help{bos_addhost} = '$server, $host, [$clone], [$cell] => Success?';
46 my($server, $host, $clone, $cell) = @_;
49 @args = ('addhost', '-server', $server, '-host', $host);
50 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
51 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
52 push(@args, '-clone') if ($clone);
53 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
54 &wrapper('bos', \@args);
58 #: AFS_bos_addkey($server, $key, $kvno, [$cell])
59 #: Add a key $key with key version number $kvno on server $server
60 #: On success, return 1.
62 $AFS_Help{bos_addkey} = '$server, $key, $kvno, [$cell] => Success?';
64 my($server, $key, $kvno, $cell) = @_;
67 @args = ('addkey', '-server', $server, '-key', $key, '-kvno', $kvno);
68 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
69 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
70 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
71 &wrapper('bos', \@args);
75 #: AFS_bos_adduser($server, \@user, [$cell])
76 #: Add users specified in @users to bosserver superuser list on $server.
77 #: On success, return 1.
79 $AFS_Help{bos_adduser} = '$server, \@user, [$cell] => Success?';
81 my($server, $user, $cell) = @_;
84 @args = ('adduser', '-server', $server, '-user', @$user);
85 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
86 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
87 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
88 &wrapper('bos', \@args);
92 #: AFS_bos_create($server, $instance, $type, \@cmd, [$cell])
93 #: Create a bnode with name $instance
94 #: The server name ($server) may be a hostname or IP address
95 #: If specified, work in $cell instead of the default cell.
96 #: On success, return 1.
98 $AFS_Help{bos_create} = '$server, $instance, $type, \@cmd, [$cell] => Success?';
100 my($server, $instance, $type, $cmd, $cell) = @_;
103 @args = ('create', '-server', $server, '-instance', $instance, '-type',
104 $type, '-cmd', @$cmd);
105 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
106 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
107 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
108 &wrapper('bos', \@args);
112 #: AFS_bos_delete($server, $instance, [$cell])
113 #: Delete a bnode with name $instance
114 #: The server name ($server) may be a hostname or IP address
115 #: If specified, work in $cell instead of the default cell.
116 #: On success, return 1.
118 $AFS_Help{bos_delete} = '$server, $instance, [$cell] => Success?';
120 my($server, $instance, $cell) = @_;
123 @args = ('delete', '-server', $server, '-instance', $instance);
124 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
125 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
126 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
127 &wrapper('bos', \@args);
131 #: AFS_bos_exec($server, $cmd, [$cell])
132 #: Exec a process on server $server
133 #: The server name ($server) may be a hostname or IP address
134 #: If specified, work in $cell instead of the default cell.
135 #: On success, return 1.
137 $AFS_Help{bos_exec} = '$server, $cmd, [$cell] => Success?';
139 my($server, $cmd, $cell) = @_;
142 @args = ('exec', '-server', $server, '-cmd', $cmd);
143 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
144 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
145 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
146 &wrapper('bos', \@args);
150 #: AFS_bos_getdate($server, $file, [$cell])
151 #: Get the date for file $file from server $server
152 #: On success, return ($exedate, $bakdate, $olddate).
154 $AFS_Help{bos_getdate} = '$server, $file, [$cell] => ($exedate, $bakdate, $olddate)';
155 sub AFS_bos_getdate {
156 my($server, $file, $cell) = @_;
157 my(@args, $exedate, $bakdate, $olddate);
159 @args = ('getdate', '-server', $server, '-file', $file);
160 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
161 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
162 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
163 &wrapper('bos', \@args,
164 [[ 'dated (.*), (no )?\.BAK', \$exedate],
165 [ '\.BAK file dated (.*), (no )?\.OLD', \$bakdate],
166 [ '\.OLD file dated (.*)\.', \$olddate]]);
167 ($exedate, $bakdate, $olddate);
170 #: AFS_bos_getlog($server, $file, [$cell])
171 #: Get log named $file from server $server
172 #: On success, return 1.
174 $AFS_Help{bos_getlog} = '$server, $file, [$cell] => Success?';
176 my($server, $file, $cell) = @_;
179 @args = ('getlog', '-server', $server, '-file', $file);
180 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
181 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
182 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
183 &wrapper('bos', \@args,
184 [[ '^Fetching log file .*', '.']], { pass_stdout });
188 #: AFS_bos_getrestart($server, [$cell])
189 #: Get the restart time for server $server
190 #: On success, return ($genrestart, $binrestart).
192 $AFS_Help{bos_getrestart} = '$server, [$cell] => ($genrestart, $binrestart)';
193 sub AFS_bos_getrestart {
194 my($server, $cell) = @_;
195 my(@args, $genrestart, $binrestart);
197 @args = ('getrestart', '-server', $server);
198 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
199 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
200 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
201 &wrapper('bos', \@args,
202 [[ '^Server .* restarts at\s*(.*\S+)', \$genrestart],
203 [ '^Server .* restarts for new binaries at\s*(.*\S+)', \$binrestart]]);
204 ($genrestart, $binrestart);
207 #: AFS_bos_install($server, \@files, [$dir], [$cell])
208 #: Install files in \@files on server $server in directory $dir
209 #: or the default directory.
210 #: The server name ($server) may be a hostname or IP address
211 #: If specified, work in $cell instead of the default cell.
212 #: On success, return 1.
214 $AFS_Help{bos_install} = '$server, \@files, [$dir], [$cell] => Success?';
215 sub AFS_bos_install {
216 my($server, $files, $dir, $cell) = @_;
219 @args = ('install', '-server', $server, '-file', @$files);
220 push(@args, '-dir', $dir) if ($dir);
221 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
222 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
223 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
224 &wrapper('bos', \@args, [[ 'bos: installed file .*', '.' ]],
225 { 'errors_last' => 1 });
229 #: AFS_bos_listhosts($server, [$cell])
230 #: Get host list on server $server.
231 #: The server name ($server) may be a hostname or IP address
232 #: If specified, work in $cell instead of the default cell.
233 #: On success, an array of hosts with the first entry being the cellname.
235 $AFS_Help{bos_listhosts} = '$server, [$cell] => @ret';
236 sub AFS_bos_listhosts {
237 my($server, $cell) = @_;
240 @args = ('listhosts', '-server', $server);
241 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
242 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
243 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
244 &wrapper('bos', \@args,
245 [[ '^Cell name is (.*)', sub {
248 [ 'Host \S+ is (\S+)', sub {
255 #: AFS_bos_listkeys($server, [$showkey], [$cell])
256 #: Get key list on server $server.
257 #: The server name ($server) may be a hostname or IP address
258 #: If specified, $showkey indicates keys and not checksums should be shown.
259 #: If specified, work in $cell instead of the default cell.
260 #: On success, an array of hosts with the first entry being the cellname.
262 $AFS_Help{bos_listkeys} = '$server, [$showkey], [$cell] => %ret';
263 sub AFS_bos_listkeys {
264 my($server, $showkey, $cell) = @_;
267 @args = ('listkeys', '-server', $server);
268 push(@args, '-showkey') if ($showkey);
269 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
270 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
271 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
272 %ret = &wrapper('bos', \@args,
273 [[ '^key (\d+) has cksum (\d+)', sub {
274 my(%ret) = %OpenAFS::wrapper::result;
276 %OpenAFS::wrapper::result = %ret;
278 [ '^key (\d+) is \'(\S+)\'', sub {
279 my(%ret) = %OpenAFS::wrapper::result;
281 %OpenAFS::wrapper::result = %ret;
283 [ '^Keys last changed on\s*(.*\S+)', sub {
284 my(%ret) = %OpenAFS::wrapper::result;
285 $ret{'date'} = $_[0];
286 %OpenAFS::wrapper::result = %ret;
288 [ 'All done.', '.']]);
292 #: AFS_bos_listusers($server, [$cell])
293 #: Get superuser list on server $server.
294 #: The server name ($server) may be a hostname or IP address
295 #: If specified, work in $cell instead of the default cell.
296 #: On success, an array of users.
298 $AFS_Help{bos_listusers} = '$server, [$cell] => @ret';
299 sub AFS_bos_listusers {
300 my($server, $cell) = @_;
303 @args = ('listusers', '-server', $server);
304 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
305 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
306 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
307 &wrapper('bos', \@args, [[ '^SUsers are: (\S+)', sub {
308 push(@ret, split(' ',$_[0]));
313 #: AFS_bos_prune($server, [$bak], [$old], [$core], [$all], [$cell])
314 #: Prune files on server $server
315 #: If $bak is specified, remove .BAK files
316 #: If $old is specified, remove .OLD files
317 #: If $core is specified, remove core files
318 #: If $all is specified, remove all junk files
319 #: On success, return 1.
321 $AFS_Help{bos_prune} = '$server, [$bak], [$old], [$core], [$all], [$cell] => Success?';
323 my($server, $bak, $old, $core, $all, $cell) = @_;
326 @args = ('prune', '-server', $server, '-bak', $bak, '-old', $old, '-core', $core, '-all', $all);
327 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
328 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
329 push(@args, '-bak') if ($bak);
330 push(@args, '-old') if ($old);
331 push(@args, '-core') if ($core);
332 push(@args, '-all') if ($all);
333 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
334 &wrapper('bos', \@args);
338 #: AFS_bos_removehost($server, $host, [$cell])
339 #: Remove a new database server host named $host from the database
341 #: On success, return 1.
343 $AFS_Help{bos_removehost} = '$server, $host, [$cell] => Success?';
344 sub AFS_bos_removehost {
345 my($server, $host, $cell) = @_;
348 @args = ('removehost', '-server', $server, '-host', $host);
349 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
350 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
351 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
352 &wrapper('bos', \@args);
356 #: AFS_bos_removekey($server, $kvno, [$cell])
357 #: Remove a key with key version number $kvno on server $server
358 #: On success, return 1.
360 $AFS_Help{bos_removekey} = '$server, $kvno, [$cell] => Success?';
361 sub AFS_bos_removekey {
362 my($server, $kvno, $cell) = @_;
365 @args = ('removekey', '-server', $server, '-kvno', $kvno);
366 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
367 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
368 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
369 &wrapper('bos', \@args);
373 #: AFS_bos_removeuser($server, \@user, [$cell])
374 #: Remove users specified in @users to bosserver superuser list on $server.
375 #: On success, return 1.
377 $AFS_Help{bos_removeuser} = '$server, \@user, [$cell] => Success?';
378 sub AFS_bos_removeuser {
379 my($server, $user, $cell) = @_;
382 @args = ('removeuser', '-server', $server, '-user', @$user);
383 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
384 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
385 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
386 &wrapper('bos', \@args);
390 #: AFS_bos_restart($server, [\@inst], [$bosserver], [$all], [$cell])
391 #: Restart bosserver instances specified in \@inst, or if $all is
392 #: specified, all instances.
393 #: If $bosserver is specified, restart the bosserver.
394 #: The server name ($server) may be a hostname or IP address
395 #: If specified, work in $cell instead of the default cell.
396 #: On success, return 1.
398 $AFS_Help{bos_restart} = '$server, [\@inst], [$bosserver], [$all], [$cell] => Success?';
399 sub AFS_bos_restart {
400 my($server, $inst, $bosserver, $all, $cell) = @_;
403 @args = ('restart', '-server', $server);
404 push(@args, '-instance', @$inst) if ($inst);
405 push(@args, '-bosserver') if ($bosserver);
406 push(@args, '-all') if ($all);
407 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
408 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
409 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
410 &wrapper('bos', \@args);
414 #: AFS_bos_salvage($server, [$partition], [$volume], [$file], [$all], [$showlog], [$parallel], [$tmpdir], [$orphans], [$cell])
415 #: Invoke the salvager, providing a partition $partition if specified, and
416 #: further a volume id $volume if specified.
417 #: If specified, $file is a file to write the salvager output into.
418 #: If specified, $all indicates all partitions should be salvaged.
419 #: If specified, $showlog indicates the log should be displayed on completion.
420 #: If specified, $parallel indicates the number salvagers that should be run
422 #: If specified, $tmpdir indicates a directory in which to store temporary
424 #: If specified, $orphans indicates how to handle orphans in a volume
425 #: (valid options are ignore, remove and attach).
426 #: The server name ($server) may be a hostname or IP address
427 #: If specified, work in $cell instead of the default cell.
428 #: On success, return 1.
430 $AFS_Help{bos_salvage} = '$server, [$partition], [$volume], [$file], [$all], [$showlog], [$parallel], [$tmpdir], [$orphans], [$cell] => Success?';
431 sub AFS_bos_salvage {
432 my($server, $partition, $volume, $file, $all, $showlog, $parallel, $tmpdir, $orphans, $cell) = @_;
435 @args = ('salvage', '-server', $server);
436 push(@args, '-partition', $partition)if ($partition);
437 push(@args, '-volume', $volume) if ($volume);
438 push(@args, '-file', $file) if ($file);
439 push(@args, '-all') if ($all);
440 push(@args, '-showlog') if ($showlog);
441 push(@args, '-parallel', $parallel) if ($parallel);
442 push(@args, '-tmpdir', $tmpdir) if ($tmpdir);
443 push(@args, '-orphans', $orphans)if ($orphans);
444 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
445 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
446 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
447 &wrapper('bos', \@args, [['bos: shutting down fs.', '.'],
448 ['Starting salvage.', '.'],
449 ['bos: waiting for salvage to complete.', '.'],
450 ['bos: salvage completed', '.'],
451 ['bos: restarting fs.', '.']],
452 { 'errors_last' => 1 });
456 #: AFS_bos_setauth($server, $authrequired, [$cell])
457 #: Set the authentication required flag for server $server to
459 #: On success, return 1.
461 $AFS_Help{bos_setauth} = '$server, $authrequired, [$cell] => Success?';
462 sub AFS_bos_setauth {
463 my($server, $authrequired, $cell) = @_;
466 @args = ('setauth', '-server', $server, '-authrequired', $authrequired);
467 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
468 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
469 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
470 &wrapper('bos', \@args);
474 #: AFS_bos_setcellname($server, $name, [$cell])
475 #: Set the cellname for server $server to $name
476 #: On success, return 1.
478 $AFS_Help{bos_setcellname} = '$server, $name, [$cell] => Success?';
479 sub AFS_bos_setcellname {
480 my($server, $name, $cell) = @_;
483 @args = ('setcellname', '-server', $server, '-name', $name);
484 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
485 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
486 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
487 &wrapper('bos', \@args);
491 #: AFS_bos_setrestart($server, $time, [$general], [$newbinary], [$cell])
492 #: Set the restart time for server $server to $time
493 #: If specified, $general indicates only the general restart time should be
495 #: If specified, $newbinary indicates only the binary restart time should be
497 #: On success, return 1.
499 $AFS_Help{bos_setrestart} = '$server, $time, [$general], [$newbinary], [$cell] => Success?';
500 sub AFS_bos_setrestart {
501 my($server, $time, $general, $newbinary, $cell) = @_;
504 @args = ('setrestart', '-server', $server, '-time', $time);
505 push(@args, '-general') if ($general);
506 push(@args, '-newbinary') if ($newbinary);
507 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
508 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
509 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
510 &wrapper('bos', \@args);
514 #: AFS_bos_shutdown($server, [\@inst], [$wait], [$cell])
515 #: Stop all bosserver instances or if \@inst is specified,
516 #: only those in \@inst on server $server
517 #: waiting for them to stop if $wait is specified.
518 #: The server name ($server) may be a hostname or IP address
519 #: If specified, work in $cell instead of the default cell.
520 #: On success, return 1.
522 $AFS_Help{bos_shutdown} = '$server, [\@inst], [$wait], [$cell] => Success?';
523 sub AFS_bos_shutdown {
524 my($server, $inst, $wait, $cell) = @_;
527 @args = ('shutdown', '-server', $server);
528 push(@args, '-instance', @$inst) if ($inst);
529 push(@args, '-wait') if ($wait);
530 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
531 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
532 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
533 &wrapper('bos', \@args);
537 #: AFS_bos_start($server, \@inst, [$cell])
538 #: Start bosserver instances in \@inst on server $server .
539 #: The server name ($server) may be a hostname or IP address
540 #: If specified, work in $cell instead of the default cell.
541 #: On success, return 1.
543 $AFS_Help{bos_start} = '$server, \@inst, [$cell] => Success?';
545 my($server, $inst, $cell) = @_;
548 @args = ('start', '-server', $server, '-instance', @$inst);
549 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
550 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
551 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
552 &wrapper('bos', \@args);
556 #: AFS_bos_startup($server, [\@inst], [$cell])
557 #: Start all bosserver instances or if \@inst is specified, only
558 #: those in \@inst on server $server .
559 #: The server name ($server) may be a hostname or IP address
560 #: If specified, work in $cell instead of the default cell.
561 #: On success, return 1.
563 $AFS_Help{bos_startup} = '$server, [\@inst], [$cell] => Success?';
564 sub AFS_bos_startup {
565 my($server, $inst, $cell) = @_;
568 @args = ('startup', '-server', $server);
569 push(@args, '-instance', @$inst) if ($inst);
570 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
571 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
572 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
573 &wrapper('bos', \@args);
577 #: AFS_bos_status($server, [\@bnodes], [$cell])
578 #: Get status for the specified bnodes on $server, or for all bnodes
579 #: if none are given.
580 #: The server name ($server) may be a hostname or IP address
581 #: If specified, work in $cell instead of the default cell.
582 #: On success, return an associative array whose keys are the names
583 #: of bnodes on the specified server, and each of whose values is
584 #: an associative array describing the status of the corresponding
585 #: bnode, containing some or all of the following elements:
586 #: - name Name of this bnode (same as key)
587 #: - type Type of bnode (simple, cron, fs)
588 #: - status Basic status
589 #: - aux_status Auxillary status string, for bnode types that provide it
590 #: - num_starts Number of process starts
591 #: - last_start Time of last process start
592 #: - last_exit Time of last exit
593 #: - last_error Time of last error exit
594 #: - error_code Exit code from last error exit
595 #: - error_signal Signal from last error exit
596 #: - commands Ref to list of commands
598 $AFS_Help{bos_status} = '$server, [\@bnodes], [$cell] => %bnodes';
600 my($server, $bnodes, $cell) = @_;
601 my(@args, %finres, %blist, @cmds);
603 @args = ('status', '-server', $server, '-long');
604 push(@args, '-instance', @$bnodes) if ($bnodes);
605 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
606 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
607 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
608 %finres = &wrapper('bos', \@args,
609 [['^(Instance)', sub {
610 my(%binfo) = %OpenAFS::wrapper::result;
613 $binfo{commands} = [@cmds] if (@cmds);
614 $blist{$binfo{name}} = \%binfo;
617 %OpenAFS::wrapper::result = ();
620 ['^Instance (.*), \(type is (\S+)\)\s*(.*)', 'name', 'type', 'status' ],
621 ['Auxilliary status is: (.*)\.', 'aux_status' ],
622 ['Process last started at (.*) \((\d+) proc starts\)', 'last_start', 'num_starts' ],
623 ['Last exit at (.*\S+)', 'last_exit' ],
624 ['Last error exit at (.*),', 'last_error' ],
625 ['by exiting with code (\d+)', 'error_code' ],
626 ['due to signal (\d+)', 'error_signal' ],
627 [q/Command \d+ is '(.*)'/, sub { push(@cmds, $_[0]) }],
630 $finres{commands} = [@cmds] if (@cmds);
631 $blist{$finres{name}} = \%finres;
636 #: AFS_bos_stop($server, \@inst, [$wait], [$cell])
637 #: Stop bosserver instances in \@inst on server $server
638 #: waiting for them to stop if $wait is specified.
639 #: The server name ($server) may be a hostname or IP address
640 #: If specified, work in $cell instead of the default cell.
641 #: On success, return 1.
643 $AFS_Help{bos_stop} = '$server, \@inst, [$wait], [$cell] => Success?';
645 my($server, $inst, $wait, $cell) = @_;
648 @args = ('stop', '-server', $server, '-instance', @$inst);
649 push(@args, '-wait') if ($wait);
650 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
651 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
652 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
653 &wrapper('bos', \@args);
657 #: AFS_bos_uninstall($server, \@files, [$dir], [$cell])
658 #: Uninstall files in \@files on server $server in directory $dir
659 #: or the default directory.
660 #: The server name ($server) may be a hostname or IP address
661 #: If specified, work in $cell instead of the default cell.
662 #: On success, return 1.
664 $AFS_Help{bos_uninstall} = '$server, \@files, [$dir], [$cell] => Success?';
665 sub AFS_bos_uninstall {
666 my($server, $files, $dir, $cell) = @_;
669 @args = ('uninstall', '-server', $server, '-file', @$files);
670 push(@args, '-dir', $dir) if ($dir);
671 push(@args, '-noauth') if ($AFS_Parms{'authlvl'} == 0);
672 push(@args, '-localauth') if ($AFS_Parms{'authlvl'} == 2);
673 push(@args, '-cell', $cell ? $cell : $AFS_Parms{'cell'});
674 &wrapper('bos', \@args, [[ '^bos: uninstalled file .*', '.' ]],
675 { 'errors_last' => 1 });