GithubHelp home page GithubHelp logo

Comments (3)

gdraheim avatar gdraheim commented on August 15, 2024

I found three occassions in start_unit_from() where a new mainpid was known but it was not overwriting the env["MAINPID"]. That should be fixed in the next release.

diff --git a/files/docker/systemctl.py b/files/docker/systemctl.py
index 5629be3..9701108 100755
--- a/files/docker/systemctl.py
+++ b/files/docker/systemctl.py
@@ -1153,7 +1153,10 @@ class Systemctl:
                 pid = self.wait_pid_file(pid_file)
                 logg.info("simp start done PID %s [%s]", pid, pid_file)
                 time.sleep(1) # give it another second to come up
-                if not self.read_pid_file(pid_file, ""):
+                pid = self.read_pid_file(pid_file, "")
+                if pid:
+                   env["MAINPID"] = pid
+                else:
                    raise Exception("could not start service")
         elif runs in [ "notify" ]:
             # "notify" is the same as "simple" but we create a $NOTIFY_SOCKET 
@@ -1211,8 +1214,11 @@ class Systemctl:
                         logg.info("NEW PID %s from sd_notify (was PID %s)", new_pid, mainpid)
                         self.write_pid_file(pid_file, new_pid)
                 logg.info("ntfy start done %s", pid_file)
-                if not self.read_pid_file(pid_file, ""):
-                   raise Exception("could not start service")
+                pid = self.read_pid_file(pid_file, "")
+                if pid:
+                    env["MAINPID"] = pid
+                else:
+                    raise Exception("could not start service")
         elif runs in [ "oneshot" ]:
             for cmd in conf.getlist("Service", "ExecStart", []):
                 check, cmd = checkstatus(cmd)
@@ -1230,6 +1236,8 @@ class Systemctl:
                 if pid_file:
                     pid = self.wait_pid_file(pid_file)
                     logg.info("fork start done PID %s [%s]", pid, pid_file)
+                    if pid:
+                        env["MAINPID"] = pid
                 else:
                     logg.warning("No PIDFile for forking %s", conf.filename())
             if not pid_file:

=> [master 21a51f4]

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 15, 2024

This one can be closed?

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 15, 2024

available in Post as well as in Pre parts now

from docker-systemctl-replacement.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.