Replies: 1 comment 3 replies
-
I think it sounds reasonable |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it be a good idea to add to mill
JavaModule
something likedef runBackgroundPidFile: Option[os.Path] = None
, and if overridden, let the variousrunBackground
tasks write the subprocess PID before completion?I'd be glad to implement this, but I thought I'd see what people thought first.
The motivation would be streamlining use of mill as a launcher for daemon processes. I do this, because I have mill turn templates into generated code and recompile, so I can edit templates and restart without further build or ceremony. It works great! But if I just use ordinary
runMain
style tasks, the launching mill process stays alive consuming whatever resources it consumes, waiting for the long running daemon to complete. Instead I can userunMainBackground
, and treat it as an old-school forking daemon. But apparently (according tosystemd
) old-school forking daemons are supposed to write the PID file of the forked subprocess before they terminate.A workaround is to have the subprocess itself generate the PID file, and
systemd
seems able to deal with that, but there's an awkward log message when the parent process dies,Can't open PID file /myapp/myapp.pid (yet?) after start: No such file or directory
Another workaround undersystemd
is just to omitPIDFile=/myapp/myapp.pid
item entirely, in which casesystemd
tries an algorithm to "guess" subprocess PIDs, which works just fine for mill'srunBackground
tasks.So it's not necessary. The workarounds work. Still, I know my setup is not conforming to the protocol
systemd
considers correct, I'm relying upon it being tolerant in what it accepts while I fail to be strict in what I produce. Letting mill itself drop subprocess PID files would fix this.Beta Was this translation helpful? Give feedback.
All reactions