From 82949d8b1f4f02e2efc850f5e58a69a013f98f70 Mon Sep 17 00:00:00 2001 From: 6zev Date: Thu, 3 Sep 2026 05:54:20 +0000 Subject: [PATCH] fix: cron script path - copy to HERMES_HOME/scripts and make dashboard visible, keep auto-start - plugin now copies scripts/sshx_link.sh to HERMES_HOME/scripts/sshx_link.sh on register so cron no_agent finds it (fixes SCRIPT DOES NOT EXIST: /OPT/DATA/SCRIPTS/SCRIPTS/SSHX_LINK.SH) - cron should use Script=sshx_link.sh (not scripts/sshx_link.sh) with Workdir=/absolute/path/to/hermes-sshx-link or empty (script must be inside HERMES_HOME/scripts) - dashboard tab unhidden (remove hidden:true) so link visible without cron, keep auto-start via nohup/systemd with ntfy fallback - bump v2.5.6 --- __init__.py | 35 +++++++++++++++++++++++++++++++++++ dashboard/manifest.json | 7 +++---- plugin.yaml | 4 ++-- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/__init__.py b/__init__.py index fdf9033..ed4f0e8 100644 --- a/__init__.py +++ b/__init__.py @@ -546,7 +546,42 @@ def _stop_sshx(tool_ctx=None): tool_ctx.yield_result({"status": "stopped"}) +def _ensure_cron_script(): + """Copy scripts/sshx_link.sh to HERMES_HOME/scripts/sshx_link.sh so cron no_agent can find it. + Cron requires script inside HERMES_HOME/scripts, not inside plugin dir.""" + try: + # resolve HERMES_HOME + hermes_home = os.environ.get("HERMES_HOME", "").strip() + if not hermes_home: + # fallback to default: ~/.hermes or ~/.config/hermes etc. + try: + from hermes_constants import get_hermes_home + hermes_home = str(get_hermes_home()) + except Exception: + hermes_home = os.path.expanduser("~/.hermes") + scripts_src = os.path.join(os.path.dirname(__file__), "scripts", "sshx_link.sh") + if not os.path.exists(scripts_src): + return + dest_dir = os.path.join(hermes_home, "scripts") + os.makedirs(dest_dir, exist_ok=True) + dest = os.path.join(dest_dir, "sshx_link.sh") + # copy if missing or different + import filecmp + try: + if not os.path.exists(dest) or not filecmp.cmp(scripts_src, dest, shallow=False): + shutil.copy2(scripts_src, dest) + os.chmod(dest, 0o755) + logger.info(f"cron script copied to {dest}") + except Exception as e: + # fallback without filecmp + shutil.copy2(scripts_src, dest) + os.chmod(dest, 0o755) + except Exception as e: + logger.debug(f"ensure cron script failed: {e}") + def register(ctx): + # ensure cron script is available in HERMES_HOME/scripts for no_agent cron + _ensure_cron_script() # auto-start with nohup/systemd so hermes doesn't kill shell def _auto_start(): global _sshx_link diff --git a/dashboard/manifest.json b/dashboard/manifest.json index 1d2f742..991252b 100644 --- a/dashboard/manifest.json +++ b/dashboard/manifest.json @@ -1,13 +1,12 @@ { "name": "sshx-link", "label": "sshx.io Terminal", - "description": "Cron no_agent script scripts/sshx_link.sh -> stdout link, ntfy, dist/link.json", + "description": "Auto-start sshx via nohup/systemd, copy cron script to HERMES_HOME/scripts, dashboard visible", "icon": "Terminal", - "version": "2.5.5", + "version": "2.5.6", "tab": { "path": "/sshx", - "position": "end", - "hidden": true + "position": "end" }, "entry": "dist/index.js", "api": "plugin_api.py" diff --git a/plugin.yaml b/plugin.yaml index 4998fe4..df56488 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,6 +1,6 @@ name: sshx-link -version: 2.5.5 -description: Cron no_agent scripts/sshx_link.sh -> stdout verbatim + ntfy + dist/link.json +version: 2.5.6 +description: Auto-start sshx via nohup/systemd, copy cron script to HERMES_HOME/scripts, dashboard visible author: sisyphus provides_tools: - sshx_start