Comments (3)
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.
This one can be closed?
from docker-systemctl-replacement.
available in Post as well as in Pre parts now
from docker-systemctl-replacement.
Related Issues (20)
- Version tag 1.5.1706 HOT 1
- 'systemctl' not working HOT 16
- Starting a service during image build / docker file, hangs HOT 7
- Possible to work with ansible service_facts module? HOT 1
- systemctl3.py not working on Rocky Linux 8 HOT 1
- Misleading error message interaction between ExecStart= and ExecStartPost= HOT 3
- systemctl enable doesn't copy service file to right place. HOT 1
- When control-C on systemctl log -f xxx, it raise an ugly KeyboardInterrupt HOT 2
- systemctl disable not disabling service at container restart HOT 1
- can this script be used on ubuntu 22.04? HOT 1
- How is this suppoused to be ussed? HOT 1
- ERROR:systemctl: nextcloud.service: Failed to parse service type, ignoring: exec HOT 1
- Install to Centos6.8 HOT 1
- StartLimitIntervalSec=0 or how to Restart Forever HOT 1
- status command shows unit files ignored by SystemD HOT 2
- systemctl show does not respect multiple `-p/--property` switches HOT 1
- BlockingIOError: [Errno 11] Resource temporarily unavailable HOT 11
- Can't understand how logs and tty are working
- Support for systemd-inhibit? HOT 1
- systemctl start virtstoraged.service Startup exception HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-systemctl-replacement.