From 4d0e06e1116bd172a1b4fa8535c1a92ffe72eb23 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 29 Jan 2022 15:51:39 -0800 Subject: [PATCH] Fix vm-server --- applets/compiler_vm/guest/bin/start-guest | 12 +++++++----- applets/compiler_vm/host/bin/vm-host-watchdog | 5 +++++ applets/compiler_vm/host/bin/vm-server | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/applets/compiler_vm/guest/bin/start-guest b/applets/compiler_vm/guest/bin/start-guest index da3319fc..7aece342 100755 --- a/applets/compiler_vm/guest/bin/start-guest +++ b/applets/compiler_vm/guest/bin/start-guest @@ -14,11 +14,13 @@ use JSON::XS; my $USERNAME = 'vm'; # variable for easier string interpolation -use constant MOD_DIR => '/usr/local/share/pbot-vm/Languages'; -use constant SERIAL => '/dev/ttyS1'; -use constant HEARTBEAT => '/dev/ttyS2'; -use constant INPUT => '/dev/stdin'; -use constant OUTPUT => '/dev/stdout'; +use constant { + MOD_DIR => '/usr/local/share/pbot-vm/Languages', + SERIAL => '/dev/ttyS1', + HEARTBEAT => '/dev/ttyS2', + INPUT => '/dev/stdin', + OUTPUT => '/dev/stdout', +}; use lib MOD_DIR; diff --git a/applets/compiler_vm/host/bin/vm-host-watchdog b/applets/compiler_vm/host/bin/vm-host-watchdog index 194fe4de..26cf0115 100755 --- a/applets/compiler_vm/host/bin/vm-host-watchdog +++ b/applets/compiler_vm/host/bin/vm-host-watchdog @@ -1,5 +1,10 @@ #!/usr/bin/env perl +# File: vm-watchdog +# +# Purpose: Monitors pbot-vm cpu usage. Resets vm to snapshot if cpu exceeds +# threshold limits. + # SPDX-FileCopyrightText: 2021 Pragmatic Software # SPDX-License-Identifier: MIT diff --git a/applets/compiler_vm/host/bin/vm-server b/applets/compiler_vm/host/bin/vm-server index 379595cc..eb741917 100755 --- a/applets/compiler_vm/host/bin/vm-server +++ b/applets/compiler_vm/host/bin/vm-server @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# File: compiler_server.pl +# File: vm-server # # Purpose: The compiler server manages the guest virtual machine state and # listens for incoming compile requests. This server can be run on any remote @@ -219,7 +219,7 @@ sub vm_server { print "Attempting compile...\n"; alarm 0; - my ($ret, $result) = execute("perl bin/compiler_run.pl $line"); + my ($ret, $result) = execute("perl vm-exec $line"); if(not defined $ret) { #print "parent continued\n";