[pve-devel] [PATCH container] pct exec: add friendly warning in case container not running

Oguz Bektas o.bektas at proxmox.com
Mon Jun 14 15:07:03 CEST 2021


Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 src/PVE/CLI/pct.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 6b63915..ae5254c 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -189,6 +189,8 @@ __PACKAGE__->register_method ({
 	if (!@{$param->{'extra-args'}}) {
 	    die "missing command";
 	}
+	die "Error: container '$param->{vmid}' not running!\n" if !PVE::LXC::check_running($param->{vmid});
+
 	exec('lxc-attach', '-n', $param->{vmid}, '--', @{$param->{'extra-args'}});
     }});
 
-- 
2.20.1






More information about the pve-devel mailing list