Re: [systemd-devel] Support for pre-restart check

2014-07-31 Thread Jóhann B. Guðmundsson


On 07/31/2014 12:41 AM, Michael Biebl wrote:

2014-07-30 14:34 GMT+02:00 Reindl Harald h.rei...@thelounge.net:

ExecStopPre would be better suited as the pre-restart check because
it would achieve the goal and also prevent stop a service until it's
configuration is fixed - that catchs cases where you stop something
for whatever reason and expect it would be started at the next boot

I don't think that would be a wise thing to do.
If I want to reboot my system, it shouldn't fail to reboot because of
a buggy apache configuration.
Apache should shutdown and simply fail to start on next reboot.





Right the solution to this cannot interfere with normal starting and 
shutdown and wont be solve with introducing yet another Exec* line in 
one form or another.


What is needed to solve this problem ( as in to reliably restart an 
application ) as far as I can tell is to introduce something like pre 
restart check which tries to start another instance of the service in an 
isolated application container, returns true if successful, is enabled 
per service, perhaps could be extended per container as well and only 
executed when systemctl restart/reload ( or implemented in try-restart ) 
$foo is run.


Providing patches for anything less then what I mention here above is a 
waste of time from my point of view since it wont solve the underlying 
problem.


JBG

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-31 Thread Reindl Harald

Am 31.07.2014 um 07:03 schrieb Jóhann B. Guðmundsson:
 On 07/31/2014 12:16 AM, Colin Guthrie wrote:
 I think the use case is pretty clear tho'. Config (or general machine
 state) has transitioned from working to broken in the time since the
 service was started and while it's really not a nice situation to find
 yourself in (relying on a running service not crashng!), this at least
 helps avoid nasty consequences for the most part while you work to fix
 things.
 
 The use case administrator want, is fixing their own lazyness and 
 incompetence not having to run the configuration syntax checker by 
 hand after they made changes to the configuration for one of those 
 handful of daemon/service that actually come with those.

strange attitude calling safety lazyness and incompetence

given that you can throw away a lot of things developed
in the past 10 years to support the user in many different
areas of IT



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-31 Thread Reindl Harald

Am 31.07.2014 um 02:41 schrieb Michael Biebl:
 2014-07-30 14:34 GMT+02:00 Reindl Harald h.rei...@thelounge.net:
 ExecStopPre would be better suited as the pre-restart check because
 it would achieve the goal and also prevent stop a service until it's
 configuration is fixed - that catchs cases where you stop something
 for whatever reason and expect it would be started at the next boot
 
 I don't think that would be a wise thing to do.
 If I want to reboot my system, it shouldn't fail to reboot because of
 a buggy apache configuration

it could simply called and failing ignored in that case
systemd knows that the system is at sthut down

 Apache should shutdown and simply fail to start on next reboot

in that case yes

Am 31.07.2014 um 02:16 schrieb Colin Guthrie: Reindl Harald wrote on 30/07/14 
13:34:
 *how* should that both help in calling apachectl -t *before* stop the
 service and in case of a error-repsonse keep it running?

 Note, just for clarity, you don't really want to run such a config test
 when explicitly stopping a service

i do want that in case it ends in a state where i can't start it afterwards
systemctl stop X  rsync data; systemctl start X and go to a coffee is
not that uncommon

 that should always succeed IMO (unless you think that systemctl
 kill ... should be used in such circumstances?)

i think so

 I really think an ExecRestartPre (or perhaps a more explicit
 ExecRestartCheck) would be a more sensible name (ExecStopPre implies it
 would run when explicitly stopping which, as noted above, I think is a
 bad plan). It wouldn't run when an ExecReload is given explicitly but if
 that operation falls back to restart, it would.

falls back?
how?

when i say systemctl reload nothing has to trigger a hard restart
and even if - in case of a broken config





signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-31 Thread Mantas Mikulėnas
On Jul 31, 2014 12:57 PM, Reindl Harald h.rei...@thelounge.net wrote:
 Am 31.07.2014 um 02:16 schrieb Colin Guthrie:
  Reindl Harald wrote on 30/07/14 13:34:
  *how* should that both help in calling apachectl -t *before* stop the
  service and in case of a error-repsonse keep it running?
 
  Note, just for clarity, you don't really want to run such a config test
  when explicitly stopping a service

 i do want that in case it ends in a state where i can't start it
afterwards
 systemctl stop X  rsync data; systemctl start X and go to a
coffee is
 not that uncommon

What if the configuration is fine in the beginning, but another admin
breaks it while your rsync is running?

-- 
Mantas Mikulėnas graw...@gmail.com
// sent from phone
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Support for pre-restart check

2014-07-30 Thread Ansgar Burchardt
Hi,

while looking at how to convert sysvinit scripts to service files in
Debian, I noticed that some scripts do an additional sanity check during
the restart action. That is, they run an extra command to validate the
configuration and only restart the service on success.

Systemd doesn't seem to provide such an option so far. Would you think
this is something one would like to see? If yes, what about the
following idea:

Add an ExecRestartPre option in the [Service] section. These commands
are executed when a restart is requested, before the service is stopped.
If they fail, the restart is aborted with an error.

Ansgar
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Reindl Harald

Am 30.07.2014 12:22, schrieb Ansgar Burchardt:
 while looking at how to convert sysvinit scripts to service files in
 Debian, I noticed that some scripts do an additional sanity check during
 the restart action. That is, they run an extra command to validate the
 configuration and only restart the service on success.
 
 Systemd doesn't seem to provide such an option so far. Would you think
 this is something one would like to see? If yes, what about the
 following idea:
 
 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error

as sysadmin i say: oh yes, that would be cool!

the first canmdidate would be Apache httpd
ExecRestartPre=/usr/sbin/apachectl -t

that would cat cases where you hard restart httpd after
library updates and some other guy made a typo in a config
or is still woking on it

apachectl graceful in such cases refuses the restart



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Jóhann B. Guðmundsson


On 07/30/2014 10:22 AM, Ansgar Burchardt wrote:

Hi,

while looking at how to convert sysvinit scripts to service files in
Debian, I noticed that some scripts do an additional sanity check during
the restart action. That is, they run an extra command to validate the
configuration and only restart the service on success.

Systemd doesn't seem to provide such an option so far. Would you think
this is something one would like to see? If yes, what about the
following idea:

Add an ExecRestartPre option in the [Service] section. These commands
are executed when a restart is requested, before the service is stopped.
If they fail, the restart is aborted with an error.



Re-sending to list due to simple clicking reply not reply-list mistake.

This has been discussed before and check the archive for that discussion 
but the bottom line is that this is not needed we already have 
ExecStartPre=, ExecStartPost=, ExecStop=, ExecStopPost=, or ExecReload= 
which cover those usecases


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Ansgar Burchardt
Hi,

On 07/30/2014 13:26, Jóhann B. Guðmundsson wrote:
 On 07/30/2014 10:22 AM, Ansgar Burchardt wrote:
 while looking at how to convert sysvinit scripts to service files in
 Debian, I noticed that some scripts do an additional sanity check during
 the restart action. That is, they run an extra command to validate the
 configuration and only restart the service on success.

 Systemd doesn't seem to provide such an option so far. Would you think
 this is something one would like to see? If yes, what about the
 following idea:

 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error.

 This has been discussed before and check the archive for that discussion
 but the bottom line is that this is not needed we already have
 ExecStartPre=, ExecStartPost=, ExecStop=, ExecStopPost=, or ExecReload=
 which cover those usecases

I searched for such discussion, but did not find anything relevant. Do
you have a link?

And how would you use the existing Exec* options to cover this usecase?
ExecStart* certainly doesn't help, ExecReload only works for reload and
not for restart.  ExecStop is to actually stop the service (and should
not fail due to invalid configuration); ExecStopPost is too late.

Ansgar

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Michal Sekletar
On Wed, Jul 30, 2014 at 11:26:38AM +, Jóhann B. Guðmundsson wrote:
 
 On 07/30/2014 10:22 AM, Ansgar Burchardt wrote:
 Hi,
 
 while looking at how to convert sysvinit scripts to service files in
 Debian, I noticed that some scripts do an additional sanity check during
 the restart action. That is, they run an extra command to validate the
 configuration and only restart the service on success.
 
 Systemd doesn't seem to provide such an option so far. Would you think
 this is something one would like to see? If yes, what about the
 following idea:
 
 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error.
 
 
 Re-sending to list due to simple clicking reply not reply-list mistake.
 
 This has been discussed before and check the archive for that
 discussion but the bottom line is that this is not needed we already
 have ExecStartPre=, ExecStartPost=, ExecStop=, ExecStopPost=, or
 ExecReload= which cover those usecases

If that is the case, we should really delete TODO item:

* maybe introduce ExecRestartPre

Michal
 
 JBG
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Lennart Poettering
On Wed, 30.07.14 12:22, Ansgar Burchardt (ans...@debian.org) wrote:

 Hi,
 
 while looking at how to convert sysvinit scripts to service files in
 Debian, I noticed that some scripts do an additional sanity check during
 the restart action. That is, they run an extra command to validate the
 configuration and only restart the service on success.
 
 Systemd doesn't seem to provide such an option so far. Would you think
 this is something one would like to see? If yes, what about the
 following idea:
 
 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error.

This has been a TODO item since a long time. The usecase seems valid. So
far nobody found the time to implement this though. Happy to take patches...

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Reindl Harald

Am 30.07.2014 13:42, schrieb Ansgar Burchardt:
 On 07/30/2014 13:26, Jóhann B. Guðmundsson wrote:
 On 07/30/2014 10:22 AM, Ansgar Burchardt wrote:
 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error.

 This has been discussed before and check the archive for that discussion
 but the bottom line is that this is not needed we already have
 ExecStartPre=, ExecStartPost=, ExecStop=, ExecStopPost=, or ExecReload=
 which cover those usecases
 
 I searched for such discussion, but did not find anything relevant. Do
 you have a link?
 
 And how would you use the existing Exec* options to cover this usecase?
 ExecStart* certainly doesn't help, ExecReload only works for reload and
 not for restart.  ExecStop is to actually stop the service (and should
 not fail due to invalid configuration); ExecStopPost is too late

they don't

ExecStopPost is too late, the service is stopped
ExecReload is a different game
ExecStartPre don't help to prevent the stop

hardly any of the existing options is able to *prevent stop*
and ignore the systemctl restart - that would be the semnatic
of a non existing ExecStopPre

Pre != Post



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Jóhann B. Guðmundsson


On 07/30/2014 12:09 PM, Lennart Poettering wrote:

On Wed, 30.07.14 12:22, Ansgar Burchardt (ans...@debian.org) wrote:


Hi,

while looking at how to convert sysvinit scripts to service files in
Debian, I noticed that some scripts do an additional sanity check during
the restart action. That is, they run an extra command to validate the
configuration and only restart the service on success.

Systemd doesn't seem to provide such an option so far. Would you think
this is something one would like to see? If yes, what about the
following idea:

Add an ExecRestartPre option in the [Service] section. These commands
are executed when a restart is requested, before the service is stopped.
If they fail, the restart is aborted with an error.

This has been a TODO item since a long time. The usecase seems valid.


We discussed this either here on the mailinglist, in a bug report in 
bz.rh or in one of the hackfest and it's on that TODO list is there 
because in the beginning I thought this was required but
after we discussed this the behaviour and after going through the more 
or less all of the legacy sysv initscripts in Fedora simply using 
ExecStartPre and ExecStop covered this but by all means introduce this 
if you no longer think that is the case.


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Jóhann B. Guðmundsson


On 07/30/2014 12:02 PM, Reindl Harald wrote:

they don't


Perhaps not in your world which seems to differ from many but in the 
world that the guy that went through and migrated around 800 legacy sysv 
initscript you want the exact same check run before the service is 
started and we already cover that with ExecStartPre=


And of those 800 it was exception not a rule if those legacy sysv 
initscript simply did not call stop/start on restart...


Ansgar Burchardt will need to post the initscript he's migrating so we 
can see if it actually provides an valid usecase to implement this I 
would be very surprised if it actually did...


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Reindl Harald

Am 30.07.2014 14:19, schrieb Jóhann B. Guðmundsson:
 On 07/30/2014 12:09 PM, Lennart Poettering wrote:
 On Wed, 30.07.14 12:22, Ansgar Burchardt (ans...@debian.org) wrote:

 while looking at how to convert sysvinit scripts to service files in
 Debian, I noticed that some scripts do an additional sanity check during
 the restart action. That is, they run an extra command to validate the
 configuration and only restart the service on success.
 
 Systemd doesn't seem to provide such an option so far. Would you think
 this is something one would like to see? If yes, what about the
 following idea:
 
 Add an ExecRestartPre option in the [Service] section. These commands
 are executed when a restart is requested, before the service is stopped.
 If they fail, the restart is aborted with an error.
 This has been a TODO item since a long time. The usecase seems valid.
 
 We discussed this either here on the mailinglist, in a bug report in bz.rh or 
 in one of the hackfest and it's on
 that TODO list is there because in the beginning I thought this was required 
 but
 after we discussed this the behaviour and after going through the more or 
 less all of the legacy sysv initscripts
 in Fedora simply using ExecStartPre and ExecStop covered this but by all 
 means introduce this if you no longer
 think that is the case

*how* should that both help in calling apachectl -t *before* stop the
service and in case of a error-repsonse keep it running?

ExecStartPre can only prevent a not or no longer running service
to start again, ExecStopPost comes after it is stopped and a
ExecStopPre don't exist

ExecStopPre would be better suited as the pre-restart check because
it would achieve the goal and also prevent stop a service until it's
configuration is fixed - that catchs cases where you stop something
for whatever reason and expect it would be started at the next boot



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Reindl Harald

Am 30.07.2014 14:35, schrieb Jóhann B. Guðmundsson:
 On 07/30/2014 12:02 PM, Reindl Harald wrote:
 they don't
 
 Perhaps not in your world which seems to differ from many

don't jump on that personal level

if you would have *read* really what you respond to and not
stop at the first two words you would realize the difference
without personal attacks - it's not a matter of worlds, it's
a *technical fact*

 but in the world that the guy that went through and migrated around 800 
 legacy sysv initscript you want the exact same check run before the 
 service is started and we already cover that with ExecStartPre=

nobody takes ExecStartPre away from you by add ExecStopPre

BTW:
what do you gain by that checkj in ExecStartPre?
ExecStart would fail anyways, so the service fails with or without

the topic is about something like ExecStopPre, what you can achieve
with it and not about which hero migrated how much sysv initscripts

 Ansgar Burchardt will need to post the initscript he's migrating so we can 
 see if it actually provides an valid usecase to implement this I would 
 be very surprised if it actually did...

step beside your migration consideration and come back to a generic level
by only consider migrations you could remove 80% of all options in systemd.exec

that below could be httpd and that's useful for a lot of other services
by just have the option to call a helper saying you don't stop me with
the current environment because of XYZ you won't be able to start me again

in case of httpd all what you need exists
for other services it could be implemented if there is a call

frankly that could be even useful outside the distribution world
for sanity checks implemented by the local administrator

Type=simple
ExecStartPre=/usr/sbin/apachectl -t
ExecStart=/usr/sbin/httpd $OPTIONS -D FOREGROUND
ExecStopPre=/usr/sbin/apachectl -t
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Jóhann B. Guðmundsson


On 07/30/2014 12:34 PM, Reindl Harald wrote:

*how*  should that both help in calling apachectl -t*before*  stop the
service and in case of a error-repsonse keep it running?


ExecStartPre= takes care of the startup check as in the usecase when the 
unit is not running and you initially configured the Apache daemon


Adding ExecStop= before actual ExecStop= line to stop the daemon takes 
care of preventing you from restarting you if you made configuration 
changes while the daemon/services was running should not continue with 
the stop process if the ExecStop command fails.


Anyway beside that point daemon,services that actual come with 
configuration file syntax checkers like apache does ( maybe in what 20 
or so range ) , are few and far between let alone those configuration 
syntax checker that actually exist out there fail properly if they do...


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Reindl Harald

Am 30.07.2014 15:04, schrieb Jóhann B. Guðmundsson:
 On 07/30/2014 12:34 PM, Reindl Harald wrote:
 *how* should that both help in calling apachectl -t *before* stop the
 service and in case of a error-repsonse keep it running?
 
 ExecStartPre= takes care of the startup check as in the usecase when 
 the unit is not running and you initially configured the Apache daemon

first: please don't ignore the last paragraphs!

takes care about what?
the service would fail with or without that

 Adding ExecStop= before actual ExecStop= line to stop the daemon 
 takes care of preventing you from restarting you if you made configuration 
 changes while the daemon/services was running should not continue with 
 the stop process if the ExecStop command fails.

but you don't need ExecStop for most services

systemd sends SIGTERM and so ExecStopPre would also affect
services without ExecStop lines which are most of mine

why? because they don't need CAP_KILL!
that's from production, no ExecStop used

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/httpd
Environment=PATH=/usr/bin:/usr/sbin
ExecStart=/usr/sbin/httpd $OPTIONS -D FOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
Restart=always
RestartSec=1
PrivateTmp=yes
NoNewPrivileges=yes
CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_IPC_LOCK CAP_NET_BIND_SERVICE 
CAP_SETGID CAP_SETUID
ReadOnlyDirectories=/etc
ReadOnlyDirectories=/usr
ReadOnlyDirectories=/var/lib
InaccessibleDirectories=/home
InaccessibleDirectories=/media
InaccessibleDirectories=/root
InaccessibleDirectories=/proc
InaccessibleDirectories=/sys
InaccessibleDirectories=/run/console
InaccessibleDirectories=/run/dbus
InaccessibleDirectories=/run/lock
InaccessibleDirectories=/run/mount
InaccessibleDirectories=/run/systemd/generator
InaccessibleDirectories=/run/systemd/system
InaccessibleDirectories=/run/systemd/users
InaccessibleDirectories=/run/udev
InaccessibleDirectories=/run/user
InaccessibleDirectories=/var/lib/dbus
InaccessibleDirectories=/var/lib/rpm
InaccessibleDirectories=/var/lib/systemd
InaccessibleDirectories=/var/lib/yum
InaccessibleDirectories=/var/spool

 Anyway beside that point daemon,services that actual come with configuration 
 file syntax checkers like apache does (maybe in what 20 or so range), are 
 few and far between let alone those configuration syntax checker that
 actually exist out there fail properly if they do...

step away from syntax checkers shipped with daemons, they are
only one usecase (and maybe there would be some more in a few
years with reliebale ways to use them with systemd)

ExecStopPost could be any script written by the local administrator
which says you don't stop that service in case service A and B are
runnining which *hard fail* if you take them away the database and
so i ordered start/shutdown of the machine correctly but without
hard Requires= and their drawbacks in units files *

drawbacks of Requires=:
stop one service required by others stops them too, but start it don't
start them at the same moment which is good because as example mysqld
can run without dbmail-imapd but not the other way round

so one could optimize the environment that restart/stop mysqld only
is possible if dbamil-imapd is not running and systemctl restart
dbmail-imapd.service mysqld.service does the correct order by
After=/Before= in the services depending on mysqld



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Colin Guthrie
Reindl Harald wrote on 30/07/14 13:34:
 *how* should that both help in calling apachectl -t *before* stop the
 service and in case of a error-repsonse keep it running?

Note, just for clarity, you don't really want to run such a config test
when explicitly stopping a service - that should always succeed IMO
(unless you think that systemctl kill ... should be used in such
circumstances?)

 ExecStopPre would be better suited as the pre-restart check because
 it would achieve the goal and also prevent stop a service until it's
 configuration is fixed - that catchs cases where you stop something
 for whatever reason and expect it would be started at the next boo

I really think an ExecRestartPre (or perhaps a more explicit
ExecRestartCheck) would be a more sensible name (ExecStopPre implies it
would run when explicitly stopping which, as noted above, I think is a
bad plan). It wouldn't run when an ExecReload is given explicitly but if
that operation falls back to restart, it would.

I think the use case is pretty clear tho'. Config (or general machine
state) has transitioned from working to broken in the time since the
service was started and while it's really not a nice situation to find
yourself in (relying on a running service not crashng!), this at least
helps avoid nasty consequences for the most part while you work to fix
things.

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Support for pre-restart check

2014-07-30 Thread Jóhann B. Guðmundsson


On 07/31/2014 12:16 AM, Colin Guthrie wrote:

I think the use case is pretty clear tho'. Config (or general machine
state) has transitioned from working to broken in the time since the
service was started and while it's really not a nice situation to find
yourself in (relying on a running service not crashng!), this at least
helps avoid nasty consequences for the most part while you work to fix
things.


The use case administrator want, is fixing their own lazyness and 
incompetence not having to run the configuration syntax checker by hand 
after they made changes to the configuration for one of those handful of 
daemon/service that actually come with those.


But let's continue on this path once that is implemented they want to be 
notified one way or another why the service failed to be restarted as in 
the actual failed line of the configuration mistake they made so they 
can go and fix it ( and apachctl -t purpose is... ) but that cannot be 
implemented in the status output because. remember they where to lazy to 
run the configuration syntax checker by hand after the change they made 
so they are to lazy to run systemctl status foo so you do realize the 
underlying problem for this cannot be solved right?


People tried in the past doing so by writing massive initscript that 
never worked...


Now that broken machine state is not limited to configuration changes 
since it could also happen due to an bad update or incompatable update ( 
configuration file syntax changes between releases, apache 2.2 vs 2.4 
for example ) so the only way you can try to solve this is by 
introducing a fake restart of the service which cannot be manually 
defined what is but has to be built in with the know of only turning it 
on or off for type units which covers *something* has changed can the 
service be restarted *safely* afterwards, if it does restart the service.


Bottom line if the intent is for systemd to solve the use case you 
stated the solution for this need to be a permanent fix that covers all 
service/daemons not yet another line that leads to administrators define 
another command to take care of that...


JBG
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel