SPB Git forge
29commits 1branches 0releases
684.0 KBsize
maindefault branch
2 days agolast push
Python 95.8% Shell 4.2%

prepare : LaunchDaemon PM2 systématique pour les REMOTE_NODES (session graphique non garantie au boot)

Simon-Pierre Boucher committed 16 days ago (Sep 8, 2026) parent 4ee7842

1 changed file +4 −2

modified mld/prepare.py +4 −2
@@ -48,10 +48,12 @@ def prepare(alias, runtimes=None, ka_helpers=False):
48 48 "launchctl list 2>/dev/null | grep -qi pm2 || launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/pm2.*.plist >/dev/null 2>&1; "
49 49 "launchctl list 2>/dev/null | grep -qi pm2 && echo ' pm2 launchd: chargé' || echo ' pm2 launchd: NON chargé'\n"
50 50 # nœud sans session graphique (loué, M2U64…) : le domaine gui n'existe pas au boot → LaunchDaemon système avec UserName
51 − "if ! launchctl print gui/$(id -u) >/dev/null 2>&1; then P=$(ls ~/Library/LaunchAgents/pm2.*.plist 2>/dev/null | head -1); "
51 + "if %s || ! launchctl print gui/$(id -u) >/dev/null 2>&1; then P=$(ls ~/Library/LaunchAgents/pm2.*.plist 2>/dev/null | head -1); "
52 52 "if [ -n \"$P\" ]; then L=$(/usr/libexec/PlistBuddy -c 'Print :Label' \"$P\"); D=/Library/LaunchDaemons/$(basename \"$P\"); "
53 53 "echo %s | sudo -S -p '' sh -c \"cp '$P' '$D' && /usr/libexec/PlistBuddy -c 'Delete :UserName' '$D' 2>/dev/null; /usr/libexec/PlistBuddy -c 'Add :UserName string %s' '$D' && chown root:wheel '$D' && chmod 644 '$D' && launchctl bootout system/$L 2>/dev/null; launchctl bootstrap system '$D' 2>/dev/null; launchctl print system/$L >/dev/null 2>&1 && echo ' pm2 LaunchDaemon (pas de session graphique) : chargé' || echo ' pm2 LaunchDaemon : NON chargé'\"; fi; fi\n") % (
54 − shlex.quote(pw), config.user_of(alias), config.home_of(alias), shlex.quote(pw), config.user_of(alias), shlex.quote(pw), config.user_of(alias))
54 + shlex.quote(pw), config.user_of(alias), config.home_of(alias), shlex.quote(pw), config.user_of(alias),
55 + # nœuds loués (REMOTE_NODES) : LaunchDaemon systématique, la session graphique n'est pas garantie au boot
56 + "true" if alias in config.REMOTE_NODES else "false", shlex.quote(pw), config.user_of(alias))
55 57 else:
56 58 script += "echo ' pm2 startup: mot de passe sudo absent (%s)'\n" % config.sudo_pw_file(alias)
57 59 rc, out, err = ssh.run(ip, script, timeout=1800)
58 60