We need to catch the SIGTERM signal to gracefully stop our app when the device is rebooted from the resin console or an update arrives.
Here is what we have:
Our dockerfile ends like this:
** rm /tmp/.X0-lock || true**
** FRAMEBUFFER=/dev/fb1 startx /bin/bash /app/start2.sh**
that runs our start2.sh script, which runs after the x server is up, there we start our electron app, and there is a small software watchdog.
/app/node_modules/electron/dist/electron /app/main.js --enable-logging &
while [ -f /app/ramdisk/watchdog ]
** rm -rf /app/ramdisk/watchdog**
** sleep 10**
We need to catch the signal in the electron app, or in any bash script, but we have tried on the 3 places, start.sh/start2.sh/electron app and somehow the signal is not reaching any.
top says the process id 1 is entry.sh (which is from resin).
I would appreciate any help!
Thank you in advance!!!