fix: wrap launchd in codesign wrapper to survive brew upgrade node

This commit is contained in:
Eddy de Vink 2026-06-13 10:33:58 +02:00
commit f46889956b
2 changed files with 26 additions and 2 deletions

View file

@ -18,7 +18,6 @@ De bot gebruikt een **speciale groep** (Dienst opvragen EdGPT-EBS) waarin **elk
- [Node.js](https://nodejs.org/) 18+ - [Node.js](https://nodejs.org/) 18+
- [wwebjs-api](https://github.com/pedroslopez/whatsapp-web.js) Docker container (poort 3000) - [wwebjs-api](https://github.com/pedroslopez/whatsapp-web.js) Docker container (poort 3000)
- WhatsApp sessie "EdGpt" actief in wwebjs-api - WhatsApp sessie "EdGpt" actief in wwebjs-api
- PM2 (optioneel, voor procesbeheer)
## Installatie ## Installatie
@ -87,8 +86,27 @@ Beide zijn uitgesloten van git via `.gitignore`.
### Starten ### Starten
De bot draait als macOS LaunchDaemon (`/Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist`) met `RunAtLoad` en `KeepAlive`.
De LaunchDaemon start via `run-dienst-bot.sh`, een wrapper die bij elke start de
code signing signature van Node.js herstelt. Dit voorkomt uitval na een `brew upgrade node`.
Herstarten:
```bash ```bash
npm start sudo launchctl bootout system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist
```
### Stoppen
```bash
sudo launchctl bootout system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist
```
### Logs bekijken
```bash
tail -f /Users/eddy/.pm2/logs/dienst-bot-out.log
tail -f /Users/eddy/.pm2/logs/dienst-bot-error.log
``` ```
Of met PM2: Of met PM2:

6
run-dienst-bot.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
NODE=/opt/homebrew/bin/node
codesign -f -s - "$NODE" 2>/dev/null
exec "$NODE" /Users/eddy/src/dienst_echo_whatsappgroep/src/index.js