<div dir="ltr">`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.<div><div><br></div><div>a couple of tips on this</div><div><br></div><div>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.</div><div><br></div><div>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.</div></div><div><br></div><div>pro-tip on "After" you can also put "mounts" to make sure you have a fs to work with.</div><div><br></div><div>sometimes you want to increase the <span style="color:rgb(0,0,0);font-family:monospace;font-size:medium;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">TimeoutStopSec </span>and maybe if your ExecStop exit inmediatly, a "sleep X" at the end</div><div><br></div><div>everithing else looks good.</div><div><br></div><div>Hope it helps</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><br>Alvaro Leiva<br></div></div></div>
<br><div class="gmail_quote">On Thu, May 24, 2018 at 12:52 PM, Leonard Rofman <span dir="ltr"><<a href="mailto:lrofman@us.mufg.jp" target="_blank">lrofman@us.mufg.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div class="m_8831186444880131135WordSection1">
<p class="MsoNormal">Hello everybody,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I am DBA and trying to setup systemd service for DB2 V11 fix pack 2a (multiple instances).<u></u><u></u></p>
<p class="MsoNormal">I’ve spent quite a bit of time on this setup without success so far.<u></u><u></u></p>
<p class="MsoNormal">I was able to get “ExecStart” part to work, but system reboot is giving me troubles.<u></u><u></u></p>
<p class="MsoNormal">DB2 crashes since “ExecStop” for some reason is not executed.<u></u><u></u></p>
<p class="MsoNormal">Please find the contents of db2.service file below.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The help on this is greatly appreciated.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="color:red">[Unit]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Description=DB2 StartUp-Shutdown<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">After=network.target<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Before=shutdown.target reboot.target halt.target<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Conflicts=shutdown.target<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:red">[Service]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Type=forking<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">RemainAfterExit=yes<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">User=achdut2<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">ExecStart=/bin/sh -c '/var/db2/home/achdut2/sqllib/<wbr>adm/db2start'<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">ExecStop=/bin/sh -c '/var/db2/home/achdut2/sqllib/<wbr>adm/db2stop force'<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Restart=always<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">Environment="DB2INSTANCE=<wbr>achdut2"<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:red">[Install]<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:red">WantedBy=multi-user.target</span><u></u><u></u></p>
</div>
<div><p></p><hr>
<p>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. </p>
<p>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. </p>
<p></p></div>
</div>
<br>______________________________<wbr>_________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/systemd-devel</a><br>
<br></blockquote></div><br></div>