|
Last change
on this file was
19262,
checked in by westram, 3 years ago
|
- add 'View sysinfo' entry to arb 'Tools' menu.
- shows 'sys.info' generated by arb_launcher.
- document 'ARB session log archive'.
|
-
Property svn:executable set to
*
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | |
|---|
| 6 | sub cannot_show() { |
|---|
| 7 | print "Error: Unable to detect console logfile\n"; |
|---|
| 8 | print "(Note: This only works if arb was started via the script 'arb')\n"; |
|---|
| 9 | die "\n"; |
|---|
| 10 | } |
|---|
| 11 | |
|---|
| 12 | sub show_log_with_less($$) { |
|---|
| 13 | my ($log,$lessopt) = @_; |
|---|
| 14 | print "Showing $log using less..\n"; |
|---|
| 15 | my $cmd = "less $ {lessopt} \"$log\""; |
|---|
| 16 | # system($cmd)==0 || die "error executing '$cmd' (result=$?)"; # always fails when less is interrupted |
|---|
| 17 | system($cmd); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | sub main() { |
|---|
| 21 | if (scalar(@ARGV)!=1) { |
|---|
| 22 | die "Usage: arb_show_log.pl logname\n "; |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | my $logname = $ARGV[0]; |
|---|
| 26 | my $server_log = $ENV{ARB_SERVER_LOG}; |
|---|
| 27 | if (not defined $server_log) { |
|---|
| 28 | print "Environment variable ARB_SERVER_LOG is not defined\n"; |
|---|
| 29 | cannot_show(); |
|---|
| 30 | } |
|---|
| 31 | |
|---|
| 32 | if ($server_log =~ /\/([^\/]+)$/o) { |
|---|
| 33 | my $logdir = $`; |
|---|
| 34 | my $runlog = undef; |
|---|
| 35 | my $lessopt = '+F'; |
|---|
| 36 | if ($logname eq 'sysinf') { |
|---|
| 37 | $runlog = $logdir.'/sys.info'; |
|---|
| 38 | $lessopt = ''; # do not show tail |
|---|
| 39 | } |
|---|
| 40 | else { |
|---|
| 41 | $runlog = $logdir.'/'.$logname.'.log'; |
|---|
| 42 | } |
|---|
| 43 | if (-f $runlog) { |
|---|
| 44 | show_log_with_less($runlog, $lessopt); |
|---|
| 45 | } |
|---|
| 46 | else { |
|---|
| 47 | print "Expected logfile '$runlog' not found\n"; |
|---|
| 48 | cannot_show(); |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | else { |
|---|
| 52 | print "Expected ARB_SERVER_LOG to contain a logfile name\n"; |
|---|
| 53 | print "(contains '$server_log')\n"; |
|---|
| 54 | cannot_show(); |
|---|
| 55 | } |
|---|
| 56 | } |
|---|
| 57 | main(); |
|---|
Note: See
TracBrowser
for help on using the repository browser.