Skip to content

Commit

Permalink
write service config...
Browse files Browse the repository at this point in the history
  • Loading branch information
mariux committed Jan 3, 2012
1 parent 857026f commit 53cc594
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mxstartup2mxvipcfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ LINE: foreach(@lines) {

next LINE unless(defined $match);

save_config_mxservice($name, $user, $script);

my @ips = split /\s*[,; ]\s*/,$ip;
my $pip = parse_ips(@ips);
print_ips_cfg($pip);
Expand Down Expand Up @@ -150,6 +152,26 @@ sub parse_ips {

##############################################################################

sub save_config_mxservice {
my ($service, $user, $script) = @_;

my $config = "$rundir/mxservice.$name.cfg";

if( -e $config) {
printf "skipping creation of $config: File already exists\n";
return;
}

printf "mxservice::$name creating service-config: $config\n";

open SCRIPT, ">", "$config" or die "can't open $config: $!";
print SCRIPT qq(MX_SRV_USER="$user"\n);
print SCRIPT qq(MX_SRV_SCRIPT="$script"\n);
close SCRIPT or die "can't close $script: $!";
}

##############################################################################

sub print_ips_cfg {
my $H = shift;

Expand Down

0 comments on commit 53cc594

Please sign in to comment.