This file is indexed.

/usr/bin/gbrowse_slave is in gbrowse 2.56+dfsg-3build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/perl 

use strict;
use Getopt::Long;
use FindBin '$Bin';
use lib "$Bin/../lib";

use Bio::Graphics::Browser2::Render::Slave;
use constant DEFAULT_PORT => 8101;

my ($port,$debug,$logfile,$pidfile,$user,$kill,$preload,$tmpdir,$prefork_copies);

my $usage = <<USAGE;
Usage: $0 [options]

Options:

    --port     -p  <port>     Network port number to listen to (default 8101).
    --prefork  -f  <children> Number of preforked copies to run (default 1)
    --verbose  -v  <level>    Verbosity level (0-3)
    --user     -u  <name>     User to run under (same as current)
    --log      -l  <path>     Log file path (default, use STDERR)
    --pid          <path>     PID file path (default, none)
    --kill     -k             Kill running server (use in conjunction with --pid).
    --preload  <path>         Path to a config file containing override information
                                and databases to preload
    --tmp|-T   <path>         Override location of configuration file cache files.

Bare-naked Gbrowse render server.  Launch with the port number to
listen on.

No other configuration information is necessary. The needed
configuration will be transmitted from the master server at run
time.

If you need to override some configuration information (for example,
to specify a different tmp_base directory for session information),
you may place it in a configuration file in the [GENERAL] section. All
options in the [GENERAL] section will override the transmitted
information.

Any [name:database] sections containing database information located
in the preload config file will be preloaded to reduce execution
latency.
USAGE
;


Getopt::Long::Configure('bundling');
GetOptions('port|p=i'       => \$port,
	   'prefork|f=i'    => \$prefork_copies,
	   'verbose|v=i'    => \$debug,
	   'logfile|l=s'    => \$logfile,
	   'pidfile|pid=s'  => \$pidfile,
	   'user|u=s'       => \$user,
	   'kill|k'         => \$kill,
	   'preload=s'      => \$preload,
	   'tmp|T=s'        => \$tmpdir,
    ) or die $usage;

if ($kill) {
    kill_running_server();
    exit 0;
}

$port           ||= DEFAULT_PORT;
$prefork_copies ||= 1;

my $server = Bio::Graphics::Browser2::Render::Slave->new(LocalPort=>$port,
							User     => $user,
							LogFile  => $logfile,
							PidFile  => $pidfile,
							PreForkCopies => $prefork_copies,
							CCacheDir=> $tmpdir,
    )
    or die "Could not create server.\n";
$server->preload_databases($preload) if $preload && -r $preload;

$server->debug($debug);
$server->run();
exit 0;

sub kill_running_server {
    my $pid;

    if ($pidfile) {
	open my $f,$pidfile or die "Can't open $pidfile: $!";
	chomp($pid = <$f>);
    }
    elsif (-d '/proc') {  # try to get pid from process list
	opendir my $d,"/proc";
	while (my $dir = readdir($d)) {
	    next unless $dir =~ /^\d+$/;
	    open my $f,"/proc/$dir/status" or next;
	    my $cmd = <$f>;
	    $cmd =~ /Name:\s+gbrowse_server/ or next;
	    $pid = $dir;
	    last;
	}
    }

    die "Can't find pid of running slave server"
	unless $pid;

    kill TERM => $pid or
	die "Could not signal process $pid: $!";
    warn "Server terminated.\n";
    unlink $pidfile if $pidfile;
}