0

env:

  • a.rpm : include apiserver program
  • apiserver:api service program using github.com/gin-gonic/gin
  • upgrader: my upgrader program written by golang

purpose: upgrade a.rpm

step:

  1. use apiserver to upload upgrade file(*.tar.gz), then decompress tar.gz and execute nohup ./upgrader >/dev/null 2>&1 &
  2. upgrader will get SIGTERM from systemd when it execute rpm -e a or systemctl stop a to kill apiserver

I found it is triggered by cgoup. When apiserver.service is stopping, systemd will kill children by cgoup.

How to avoid this?

chenhao
  • 19
  • 6
  • `nohup` only protects the program it runs from receiving the `SIGHUP` (hence the name). But that's basically all I can say based on the question's text. It appears to talk about two pieces of custom software (supposedly written by you, but I'm not sure) without any specifics. As such, the question is unanswerable. (And it's certainly not about programming in Go, so please don't tag it as such.) – kostix Mar 14 '22 at 12:02
  • I found it is triggered by systemd + cgroup. – chenhao Mar 17 '22 at 11:05
  • [systemd-run --unit=my_system_upgrade --scope --slice=my_system_upgrade_slice -E setsid nohup upgrader >/dev/null 2>&1 &](https://stackoverflow.com/questions/35200232/how-to-launch-a-process-outside-a-systemd-control-group) – chenhao Mar 18 '22 at 08:50

0 Answers0