[systemd-devel] systemd DB2 StartUp/Shutdown service on Red Hat Enterprise Linux Server release 7.4 (Maipo)
aleivag
aleivag at gmail.com
Thu May 24 21:15:39 UTC 2018
`Before` means that if your service and everything in `Before` (e.g.
shutdown.target) is started at the same time, your service will be started
Before the other, but when all are been stopped, your service will get
Stoped After the other (you can see why you don't want your service stopped
after shutdown.taregt), After is the opposite of that.
a couple of tips on this
i would remove the Before and the Conflicts, and enable your service. since
its in multi-user.taget, it will get stoped alongside all other services.
I would put in "After" all the things you need to have runing while
shutting down your service... its a database, you probably dont need weird
stuff.. but if you connect to any other service in the same box you
probably want to put those there. i normally put sshd.service and
dbus.service, because i like to be able ssh and look at the things that are
been shutting down, and dbus because you want a semi-funtional. keep in
mind that this 2 are probably irrelevant, since you have
After=network.target.
pro-tip on "After" you can also put "mounts" to make sure you have a fs to
work with.
sometimes you want to increase the TimeoutStopSec and maybe if your
ExecStop exit inmediatly, a "sleep X" at the end
everithing else looks good.
Hope it helps
Alvaro Leiva
On Thu, May 24, 2018 at 12:52 PM, Leonard Rofman <lrofman at us.mufg.jp> wrote:
> Hello everybody,
>
>
>
> I am DBA and trying to setup systemd service for DB2 V11 fix pack 2a
> (multiple instances).
>
> I’ve spent quite a bit of time on this setup without success so far.
>
> I was able to get “ExecStart” part to work, but system reboot is giving me
> troubles.
>
> DB2 crashes since “ExecStop” for some reason is not executed.
>
> Please find the contents of db2.service file below.
>
>
>
> The help on this is greatly appreciated.
>
>
>
> Regards
>
>
>
>
>
> [Unit]
>
> Description=DB2 StartUp-Shutdown
>
> After=network.target
>
> Before=shutdown.target reboot.target halt.target
>
> Conflicts=shutdown.target
>
>
>
> [Service]
>
> Type=forking
>
> RemainAfterExit=yes
>
> User=achdut2
>
> ExecStart=/bin/sh -c '/var/db2/home/achdut2/sqllib/adm/db2start'
>
> ExecStop=/bin/sh -c '/var/db2/home/achdut2/sqllib/adm/db2stop force'
>
> Restart=always
>
> Environment="DB2INSTANCE=achdut2"
>
>
>
> [Install]
>
> WantedBy=multi-user.target
>
> ------------------------------
>
> Please note the MUFG logo and name is a service mark of Mitsubishi UFJ
> Financial Group, Inc. (“MUFG”) and may be used by it or other Group
> companies for marketing purposes, including MUFG Americas Holdings
> Corporation affiliates and subsidiaries. Lending, deposit, securities,
> investment banking, and other banking services are provided by banking
> and/or broker-dealer affiliates of MUFG, including, MUFG Bank, Ltd. (“MUFG
> Bank”), MUFG Union Bank, N.A. (“Union Bank”), MUFG Securities Americas Inc.
> (“MUSA”), and MUFG Securities (Canada), Ltd. (“MUS(CAN)”). MUFG Bank is not
> an FDIC-insured bank. MUB is an FDIC-insured bank. MUSA is a member of
> FINRA and SIPC. MUS(CAN) is a member of IIROC and CIPF.
>
> This message is intended for the named addressee(s) only. It may contain
> confidential, proprietary or legally privileged information. No
> confidentiality or privilege is waived or lost by any mis-transmission. If
> you receive this message in error, please delete it and all copies from
> your system, destroy any hard copies and notify the sender. You must not,
> directly or indirectly, use, disclose, distribute, print or copy any part
> of this message if you are not the intended recipient. MUFG, its affiliates
> and subsidiaries reserve the right to monitor all electronic communications
> through their respective networks. Any views expressed in this message are
> those of the individual sender and do not constitute investment advice or
> recommendation, except where the message expressly states otherwise and the
> sender is authorized to furnish the same. MUFG (and its subsidiaries) shall
> (will) not be liable for the message if modified.
>
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180524/63b04e4e/attachment.html>
More information about the systemd-devel
mailing list