On Tue, Aug 18, 2020 at 8:53 PM marcy cortes <[email protected]>
wrote:

> It's not fun...
>
> We have a .service file of type forking that calls a script of ours to
> start it and stop it.
> systemd is cool with that.
> However, if you stop and then start db2 outside of db2 it's no longer
> associated with that service and systemd whacks its processes at shutdown
> time, resulting generally in a database that needs repair :(   (MQ qmgrs
> have the same issue).
> So one must remember to always use "systemctl stop/start" instead.
> That requires root authority.
> DBA's don't get that.
> We have something in place for them to use a script authorized in our
> security system.  Think sudo on steroids.
> Now what if they forget?   Well, we also had to make a monitoring process
> that detects if db2 is not started under systemd and nags them to stop it
> and start it the correct way.
>
> Hope that helps.
>

Thank you, very much. Yes, it does not look fun. So in your service file
you have execstart and execstop pointing to a wrapper which after running
db2 commands just exits? Do you specify the pidfile and does the wrapper
script update pidfile? Without it, systemd probably is not able to figure
out if service is running or not and probably would make stopping the
service  with systemctl command difficult.
I am surprised that there is no obvious and elegant way to do it. All the
documentation explains automatic startup but so far I found nothing about
automatic but graceful stopping ... which probably is even more important
than starting.

But your email helped me to think about something else ...  I might create
a "special" service( reboot-guard.service - even redhat propouses something
like that in one of their articles) which disables/enables
reboot/shutdown/poweroff commands depending if it is enabled or not which
basically would keep anyone away from rebooting it when db2 is running.
Then I would create a simple stop_and_reboot , stop_and_shutdown scripts
which would stop the database, disable the reboot-guard.service (which is
enabled back again by another service on boot) , and then reboot the server
...
I thought I was done with cooking all of these inhouse solutions which
noone will understand in 5 years from now ...

Gregory

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www2.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to