From cc416b885fd23beb286ebd241b3ffca71fcc08a6 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Wed, 22 Nov 2023 16:49:13 +0100 Subject: [PATCH] update shell plugins --- public_html/deployment/plugins/rollout/ssh/rollout_ssh.php | 1 - public_html/deployment/plugins/shellcmd/load/plugin.php | 5 ++--- .../deployment/plugins/shellcmd/plugins_shellcmd.class.php | 6 ++++-- .../deployment/plugins/shellcmd/processes/plugin.php | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/public_html/deployment/plugins/rollout/ssh/rollout_ssh.php b/public_html/deployment/plugins/rollout/ssh/rollout_ssh.php index f4e38fcb..012fe813 100644 --- a/public_html/deployment/plugins/rollout/ssh/rollout_ssh.php +++ b/public_html/deployment/plugins/rollout/ssh/rollout_ssh.php @@ -36,7 +36,6 @@ class rollout_ssh extends rollout_base { public function getDeployCommands($sPhase,$bMask=false){ $aReturn=array(); $aConfig=$this->getConfig($sPhase); - $aTargethosts = explode(',', $aConfig['hosts']); // loop over hosts and create shell commands for it foreach(explode(',', $aConfig['hosts']) as $sMyHost){ diff --git a/public_html/deployment/plugins/shellcmd/load/plugin.php b/public_html/deployment/plugins/shellcmd/load/plugin.php index 0188143f..1c6655be 100644 --- a/public_html/deployment/plugins/shellcmd/load/plugin.php +++ b/public_html/deployment/plugins/shellcmd/load/plugin.php @@ -8,11 +8,10 @@ */ class shellcmd_load { /** - * @var command line to exectute + * @var fallback command line to exectute; command in config.josn has priority */ protected $_command='uptime'; - /** * constructor ... returns command * @return string @@ -35,7 +34,7 @@ class shellcmd_load { return $this->_command; } - + /** * parse output and extract wanted values in section "data" * @return array diff --git a/public_html/deployment/plugins/shellcmd/plugins_shellcmd.class.php b/public_html/deployment/plugins/shellcmd/plugins_shellcmd.class.php index 747d07f1..19516e80 100644 --- a/public_html/deployment/plugins/shellcmd/plugins_shellcmd.class.php +++ b/public_html/deployment/plugins/shellcmd/plugins_shellcmd.class.php @@ -14,6 +14,7 @@ class shellcmd { protected $_oPlugin=false; protected $_aReturn=false; + protected $_aResult=[]; protected $_debug=false; /** @@ -90,8 +91,9 @@ class shellcmd { if (!$this->_oPlugin){ return $this->_aReturn; } - - $sCmd=$this->_oPlugin->getCommand(); + $sInfofile=$this->_sPlugin.'/config.json'; + $aMeta=json_decode(file_get_contents($sInfofile), 1); + $sCmd=isset($aMeta['command']) ? $aMeta['command'] : $this->_oPlugin->getCommand(); $this->_wd("sCmd=$sCmd"); $this->_aResult=$this->_execCommand($sCmd); diff --git a/public_html/deployment/plugins/shellcmd/processes/plugin.php b/public_html/deployment/plugins/shellcmd/processes/plugin.php index ae008a51..327065c9 100644 --- a/public_html/deployment/plugins/shellcmd/processes/plugin.php +++ b/public_html/deployment/plugins/shellcmd/processes/plugin.php @@ -8,10 +8,9 @@ */ class shellcmd_processes { /** - * @var command line to exectute + * @var fallback command line to exectute; command in config.josn has priority */ - protected $_command="ps -f --forest | egrep -v '[/\ ](apache|httpd|php-fpm)' | fgrep -v 'ps -f' | fgrep -v grep"; - // protected $_command="ps -ef --forest "; + protected $_command="ps -ef --forest "; /** * constructor ... returns command -- GitLab