#!/usr/bin/perl # # This manages does two main tasks; # - On Striker dashboards, it enables and disabled the "Install Target" feauter. # - On nodes and DR hosts, it opens and closes VNC ports as servers are booted or stopped. # # Examples; # - Call without any arguments and it will check for running servers and, for each it will open the VNC port # on both the BCN and IFN. Before doing so, it will check 'servers::::vnc::'. If that # is found and set to '0', the port will not be opened on the network. For example, to prevent a server # named 'foo' from being accessible over 'ifn1', set 'servers::foo::vnc::ifn1 = 0'. The network name comes # from the first part of the interface name with the IP address. So for 'ifn1_bond1', the network is # 'ifn1'. # - Call it with '--enable-install-target' or '--disable-install-target' to enable or disable the "Install # Target" feature. This also enables or disables the dhcpd daemon. This can also be called as an Anvil jobs # to enable or disable the Install Target by setting the 'job_data' to 'install-target::enable' or # 'install-target::disable'. # # # Exit codes; # 0 = Normal exit. # # use strict; use warnings; use Anvil::Tools; # Disable buffering $| = 1; my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0]; my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0]; if (($running_directory =~ /^\./) && ($ENV{PWD})) { $running_directory =~ s/^\./$ENV{PWD}/; } my $anvil = Anvil::Tools->new({log_level => 2, log_secure => 1}); $anvil->Storage->read_config({file => $anvil->data->{path}{configs}{'anvil.conf'}}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, key => "log_0115", variables => { program => $THIS_FILE }}); # Read switches $anvil->data->{switches}{'y'} = ""; $anvil->Get->switches; # We're done $anvil->nice_exit({exit_code => 0}); ############################################################################################################# # Private functions. # #############################################################################################################