From 77876562f18b52dbe2c0dd19c7d4071656df5bf3 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 8 Jul 2025 11:28:38 +0200 Subject: [PATCH] add remote_cmd, to be used with python -i getsestuff --- getsestuff | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/getsestuff b/getsestuff index e3afa4d..c7fa6ee 100755 --- a/getsestuff +++ b/getsestuff @@ -612,16 +612,21 @@ def print_help(): print(" replace by allin for applying to all instruments") +def remote_cmd(command, instlist=None): + # to be used with "python -i getsestuff" + for inst in instlist or instruments: + print(f'===== {inst} ' + '=' * (70-len(inst))) + os.environ['SSHPASS'] = inst.upper()+'LNS' + docmd(f'sshpass -e ssh {inst}@{inst} {command}') + + if remote: if not doit: action_arg = 'check ' + action_arg if selected_instruments is None: print_help() else: - for inst in selected_instruments: - print(f'===== {inst} ' + '=' * (70-len(inst))) - os.environ['SSHPASS'] = inst.upper()+'LNS' - docmd(f'sshpass -e ssh {inst}@{inst} getsestuff {action_arg} nohelp') + remote_cmd(f'getsestuff {action_arg} nohelp', selected_instruments) sys.exit(0)