Re: [systemd-devel] Performing a config check before restarting a process
On 13 May 2016 at 00:04, Terry Burton <t...@terryburton.co.uk> wrote: > I have a process (ISC DHCP) that has no reload or soft restart > mechanism. The only way to "reload" it is a stop and start. > > I understand systemd's design choice of maintaining a clear > distinction between reload and restart based on whether the service is > interrupted or not, so it's clear that I should use restart. > > However, in the event that the user invokes "restart" I would like to > validate the config file before taking the Stop action to avoid loss > of service (as was the case for the reload action of my previous init > scripts.) > > We do not however have ExecStopPre and there does not appear to be a > way to interrupt a Stop action based on the result of ExecStop so I'm > not sure where that leaves me? Does anyone have a useful recipe that > accomplishes this? > > Perhaps such a config check is considered one of those things that > lives in a support script or user's best practises outside of the init > system... That seems a shame though. A quick nudge before moving along... ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Performing a config check before restarting a process
Hi, I have a process (ISC DHCP) that has no reload or soft restart mechanism. The only way to "reload" it is a stop and start. I understand systemd's design choice of maintaining a clear distinction between reload and restart based on whether the service is interrupted or not, so it's clear that I should use restart. However, in the event that the user invokes "restart" I would like to validate the config file before taking the Stop action to avoid loss of service (as was the case for the reload action of my previous init scripts.) We do not however have ExecStopPre and there does not appear to be a way to interrupt a Stop action based on the result of ExecStop so I'm not sure where that leaves me? Does anyone have a useful recipe that accomplishes this? Perhaps such a config check is considered one of those things that lives in a support script or user's best practises outside of the init system... That seems a shame though. Thanks, Terry ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Creating .service files for sets of similar services
On 26 February 2016 at 14:14, Mantas Mikulėnas <graw...@gmail.com> wrote: > On Fri, Feb 26, 2016 at 3:06 PM, Terry Burton <t...@terryburton.co.uk> wrote: >> I have an application that in part consists of a number of instances >> of similar processes (each with their own configuration and bound to >> neighbouring ports, etc.) >> >> I could create a .service file for each instance from a template but >> I'm wondering whether systemd has some built-in way of handling this >> situation. Maybe something akin to generators but for services based >> on a template and with fewer early-boot requirements? >> >> Previously I had a single init script (init.d.fake/app-N) to which I >> pointed a symlink for each instance (e.g. init.d/app-5) and the init >> script would extract the instance number from $0. So only a single >> file to maintain. Systemd seems just a little more awkward. > > https://www.freedesktop.org/software/systemd/man/systemd.unit.html – search > for "instance". You're looking for %i and the `app@.service` syntax. Exactly what I need. Thanks. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Creating .service files for sets of similar services
Hi, I have an application that in part consists of a number of instances of similar processes (each with their own configuration and bound to neighbouring ports, etc.) I could create a .service file for each instance from a template but I'm wondering whether systemd has some built-in way of handling this situation. Maybe something akin to generators but for services based on a template and with fewer early-boot requirements? Previously I had a single init script (init.d.fake/app-N) to which I pointed a symlink for each instance (e.g. init.d/app-5) and the init script would extract the instance number from $0. So only a single file to maintain. Systemd seems just a little more awkward. Obviously its trivial to template this outside of systemd but am I missing something native? Thanks, Terry ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel