-
Notifications
You must be signed in to change notification settings - Fork 131
Change to systemd type simple #165
base: master
Are you sure you want to change the base?
Conversation
Simpler and more stable.
Thanks for the patch. |
This is generally a good idea but in reality, as ever, it's not quite as clear cut. systemd uses process groups to determine any processes that are started by the command in the unit file so there is no need to rely on PID files. This also works if a program starts, forks other processes and then exits. In other words, sometimes "forking" is the best option. In the case of I would also suggest that it might be sensible to use the |
Further useful discussion here: https://www.redhat.com/en/blog/converting-traditional-sysv-init-scripts-red-hat-enterprise-linux-7-systemd-unit-files |
Now, I'm testing this patch and here is the result.
From td-agent log, supervisor seems to recevie 2 same signals.
How to avoid this 2 signal problem? |
@repeatedly I have pushed a fix. Relevant docs: https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStop= @robinbowes' suggestion to use |
We can't add |
Is there a reason why td-agent is logging to a file instead of STDOUT? (which is then captured by |
@sandstrom I can't comment in this specific case, but I've recently changed the hadoop-ptd services to do just that (log to STDOUT/journald) |
@robinbowes Got it! @repeatedly Is there a reason why you are logging to a file instead of |
@sandstrom Because some users monitor td-agent.log in their monitoring system. So how about providing 3 unit files for the migration? td-agent 3
td-agent 4
|
@repeatedly Good point! (it is a breaking change) I am not sure I'd provide three unit files though, I think it can cause needless confusion (and the names aren't enough to explain the difference, one would still need to dig around in the unit files themselves to learn that they do logging differently). Instead I'd add the two examples ( That way people can easily adjust their service-file if needed. (this is just my thinking, it is your decision to choose how you want to solve this, of course) |
@Tom-Fawcett How about above 3 unit approches for exsting users? |
@repeatedly I don't think the change in this PR is breaking, I intentionally did not change user functionality like logging to file vs journal. Therefore I don't believe the 3 unit approach is required. However, I would not want you to just take my word for it. As I have not, for example, tested how your packages upgrade. |
I noticed current patch breaks existing environment because pid file is removed. |
Ah yes, if users rely on the PID file for something other than init that may be an issue. |
Does systemd provide the feature to create additional file after start? |
@repeatedly No, systemd cannot create pid-files. The functionality that pid-files provide (looking up the process id of a process) is handled by systemd (for example But if you want to be on the safe side, make this a breaking change (i.e. add it only during a major version bump). Aside: any chance you'll have time to look at an Ubuntu 18.04 package? Would be awesome! 😄 |
Hmm... I see.
Will be released: #176 |
I found similar issue at gogs/gogs#3120.
|
Good idea, and then drop the pid-file altogether as a breaking change in the next major release (or make all of this a breaking change, depending on what's easiest). |
How about only dropping the PID file if an env var is set? That way you can easily deprecate. |
What does this mean? Does systemd support env var based condition? @minimum2scp |
I mean something like this...
|
This resolves #279. |
Systemd does not require a process to daemonize.
Using
Type=simple
(where possible) is simpler and more robust.Sources: