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
This commit is contained in:
parent
acbd7634a4
commit
82949d8b1f
35
__init__.py
35
__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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue