#!/usr/bin/perl

use strict;
use warnings;
use lib "/opt/pos/lib";
use App::POS::Utils qw( dns_update biz_name_dns public_ip );

my $show_biz_name = shift;

if (defined $show_biz_name) {
  my $public_ip = public_ip();
  my $biz_name = biz_name_dns();
  print "$biz_name.pos#$public_ip\n";
  exit;
}

my $has_network = `/opt/pos/common/bin/has_network`;
chop($has_network);

if ($has_network eq 'YES') {
  dns_update();
}
else {
  print STDERR "DNS update ERROR... No internet connection...\n";
}


