<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Just FYI and for the sake of cross
referencing, the inhibition logic was mentioned on the list today
in a thread: "systemd-inhibit don't work".</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">A developer says he will work on the
patch for this RFE shortly.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Col<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Zheng SHAO wrote on 04/08/2020 13:39:<br>
</div>
<blockquote type="cite"
cite="mid:9A631DE7-1E80-485B-A24E-F53A96893795@colopl.co.jp">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Hello,
<div class=""><br class="">
</div>
<div class="">First thanks for your advise.</div>
<div class=""><br class="">
</div>
<div class="">I didn’t know inhibit before, today I read the
document</div>
<div class="">and did few simple tests, here is one of these.</div>
<div class=""><br class="">
</div>
<div class="">$ sudo systemd-inhibit --what=shutdown
--who=graceful-shutdown --why="Keep application working"
--mode=“block” /bin/sleep 60</div>
<div class=""><br class="">
</div>
<div class="">Unfortunately once ACPI G2 soft off signal comes,
the system begin to</div>
<div class="">shutdown immediately, I’m still figuring out
why systemd-inhibit did not block the shutdown process.</div>
<div class=""><br class="">
</div>
<div class="">At the same time, I found an interesting project
which try to block shutdown completely.</div>
<div class=""><a href="https://github.com/ryran/reboot-guard"
class="" moz-do-not-send="true">https://github.com/ryran/reboot-guard</a></div>
<div class=""><br class="">
</div>
<div class="">Thanks!</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Aug 4, 2020, at 4:01, Colin Guthrie <<a
href="mailto:gmane@colin.guthr.ie" class=""
moz-do-not-send="true">gmane@colin.guthr.ie</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="caret-color: rgb(0, 0, 0);
font-family: Menlo-Regular; font-size: 18px; font-style:
normal; font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Zheng SHAO wrote on 03/08/2020
13:31:</span><br style="caret-color: rgb(0, 0, 0);
font-family: Menlo-Regular; font-size: 18px; font-style:
normal; font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<blockquote type="cite" style="font-family: Menlo-Regular;
font-size: 18px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">Hello,<br class="">
<br class="">
We are finding a robust way to handle ACPI G2 soft off
signal to graceful shutdown our application.<br class="">
To simplifier the problem, consider our instance is
running with Nginx behind a load balancer.<br class="">
When the ACPI G2 soft off signal comes to the Nginx
instance, we want to do these jobs<br class="">
<br class="">
1. Keep current HTTP connection works.<br class="">
2. Fail the health check in load balance side.<br
class="">
3. Make sure new connection not comes from load
balancer.<br class="">
4. Kill long connections if any connection exceeds to 60
seconds.<br class="">
5. Continue shutdown process.<br class="">
<br class="">
We are considering to achieve this by 2 options,<br
class="">
1. Add a custom handler for `HandlePowerKey` in
/etc/systemd/logind.conf.<br class="">
2. Add a system service so when systemd starting
shutdown, this service will be run first and block other
service to be killed.<br class="">
</blockquote>
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Have you considered writing a
service that takes a systemd-inhibit</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">shutdown lock?</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">This might not work but looking
very quickly at</span><br style="caret-color: rgb(0, 0,
0); font-family: Menlo-Regular; font-size: 18px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">
<a
href="https://www.freedesktop.org/wiki/Software/systemd/inhibit/"
style="font-family: Menlo-Regular; font-size: 18px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; orphans:
auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">https://www.freedesktop.org/wiki/Software/systemd/inhibit/</a><span
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class=""><span
class="Apple-converted-space"> </span>it would</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">appear you get a
PrepareForShutdown signal which could kick off your
steps.</span><br style="caret-color: rgb(0, 0, 0);
font-family: Menlo-Regular; font-size: 18px; font-style:
normal; font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Depending on how things work, you
could just introduce a "delay" inhibit</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">rather than a "block", e.g. a 70s
delay could give you a bit of headroom</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">to trigger fail the LB's health
check.</span><br style="caret-color: rgb(0, 0, 0);
font-family: Menlo-Regular; font-size: 18px; font-style:
normal; font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Or perhaps you could take a block
lock, then when the</span><br style="caret-color: rgb(0,
0, 0); font-family: Menlo-Regular; font-size: 18px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">prepareForShutdown() signal comes
in, fail the LB, then when that is</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">confirmed, add a new 60s delay
inhibit (not sure if this works after</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">shutdown has been triggered), then
release the block inhibit and just</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">wait for everything else to run
it's course? Alternatively just keep the</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">block inhibit right up until you
want step 5 to begin.</span><br style="caret-color:
rgb(0, 0, 0); font-family: Menlo-Regular; font-size:
18px; font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Again, this is pure speculation
and the default handler for</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">HandlePowerKey may bypass login
(tho' I suspect not) and others may</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">explain other reasons why this
approach may not work.</span><br style="caret-color:
rgb(0, 0, 0); font-family: Menlo-Regular; font-size:
18px; font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Good luck</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Col</span><br style="caret-color:
rgb(0, 0, 0); font-family: Menlo-Regular; font-size:
18px; font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<blockquote type="cite" style="font-family: Menlo-Regular;
font-size: 18px; font-style: normal; font-variant-caps:
normal; font-weight: normal; letter-spacing: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px; text-decoration: none;"
class="">The method[2] is a preferred way, but we can
not find a correct implement for this.<br class="">
<br class="">
```<br class="">
[Unit]<br class="">
Description=Delay shutdown<br class="">
After=network-online.target network.target
rsyslog.service<br class="">
After=google-instance-setup.service
google-network-daemon.service<br class="">
After=systemd-user-sessions.service sshd.service
google-fluentd.service user.slice system.slice
nss-user-lookup.target logind.service<br class="">
Wants=network-online.target network.target
rsyslog.service google-instance-setup.service
google-network-daemon.service
systemd-user-sessions.service sshd.service
google-fluentd.service user.slice system.slice
multi-user.target nss-user-lookup.target logind.service<br
class="">
<br class="">
[Service]<br class="">
Type=oneshot<br class="">
ExecStart=/bin/true<br class="">
ExecStop=/root/shutdown.sh<br class="">
RemainAfterExit=yes<br class="">
KillMode=none<br class="">
TimeoutStopSec=0<br class="">
StandardOutput=journal+console<br class="">
<br class="">
[Install]<br class="">
WantedBy=multi-user.target<br class="">
```<br class="">
<br class="">
/root/shutdown.sh<br class="">
```<br class="">
#!/bin/bash<br class="">
<br class="">
echo start shutdown<br class="">
echo sleep 300<br class="">
sleep 300<br class="">
echo end shutdown<br class="">
```<br class="">
<br class="">
We checked console output shows as follow,<br class="">
```<br class="">
CentOS Linux 7 (Core)<br class="">
Kernel 3.10.0-1127.10.1.el7.x86_64 on an x86_64<br
class="">
<br class="">
shao-redis-prd-base login: Aug 3 21:19:25
shao-redis-prd-base chronyd[449]: Selected source
169.254.169.254<br class="">
Aug 3 21:20:01 shao-redis-prd-base systemd: Created
slice User Slice of root.<br class="">
Aug 3 21:20:01 shao-redis-prd-base systemd: Started
Session 1 of user root.<br class="">
Aug 3 21:20:01 shao-redis-prd-base systemd: Removed
slice User Slice of root.<br class="">
Aug 3 21:20:11 shao-redis-prd-base systemd: Started
Unbound recursive Domain Name Server.<br class="">
Aug 3 21:20:11 shao-redis-prd-base systemd: Reached
target Host and Network Name Lookups.<br class="">
Aug 3 21:20:11 shao-redis-prd-base unbound: [1204:0]
notice: init module 0: ipsecmod<br class="">
Aug 3 21:20:11 shao-redis-prd-base unbound: [1204:0]
notice: init module 1: validator<br class="">
Aug 3 21:20:11 shao-redis-prd-base unbound: [1204:0]
notice: init module 2: iterator<br class="">
Aug 3 21:20:11 shao-redis-prd-base unbound: [1204:0]
info: start of service (unbound 1.6.6).<br class="">
Aug 3 21:20:59 shao-redis-prd-base systemd: Created
slice User Slice of xxx.<br class="">
Aug 3 21:20:59 shao-redis-prd-base systemd: Started
Session 2 of user xxx.<br class="">
Aug 3 21:21:29 shao-redis-prd-base systemd: Reached
target Multi-User System.<br class="">
Aug 3 21:21:29 shao-redis-prd-base systemd: Starting
Update UTMP about System Runlevel Changes...<br class="">
Aug 3 21:21:29 shao-redis-prd-base systemd: Started
Update UTMP about System Runlevel Changes.<br class="">
Aug 3 21:21:29 shao-redis-prd-base systemd: Startup
finished in 768ms (kernel) + 2.006s (initrd) + 2min
13.532s (userspace) = 2min 16.307s.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Removed
slice
system-selinux\x2dpolicy\x2dmigrate\x2dlocal\x2dchanges.slice.<br
class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped Aug
3 21:23:09 shao-redis-prd-base systemd: Stopped ACPI
Event Daemon.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Authorization Manager.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped Job
spooling tools.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Getty on tty1.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Serial Getty on ttyS0.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped NTP
client/server.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Google OSConfig Agent.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Command Scheduler.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Unbound recursive Domain Name Server.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Removed
slice system-serial\x2dgetty.slice.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Starting
Show Plymouth Power Off Screen...<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Removed
slice system-getty.slice.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Session 2 of user kuma.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Removed
slice User Slice of kuma.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopping
Login Service...<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Login Service.<br class="">
[ 236.662420] shutdown.sh[1265]: start shutdown<br
class="">
[ 236.662802] shutdown.sh[1265]: sleep 300<br class="">
Aug 3 21:23:09 shao-redis-prd-base shutdown.sh: start
shutdown<br class="">
Aug 3 21:23:09 shao-redis-prd-base shutdown.sh: sleep
300<br class="">
Aug 3 21:23:09 shao-redis-prd-base
GCEMetadataScripts[1266]: 2020/08/03 21:23:09
GCEMetadataScripts: Starting shutdown scripts (version
20200706.00).<br class="">
Aug 3 21:23:09 shao-redis-prd-base
GCEMetadataScripts[1266]: 2020/08/03 21:23:09
GCEMetadataScripts: No shutdown scripts to run.<br
class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Google Compute Engine Shutdown Scripts.<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Received
SIGRTMIN+20 from PID 1276 (plymouthd).<br class="">
<br class="">
[[32m OK [0m] Started Show Plymouth Power Off
Screen.<br class="">
<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Started
Show Plymouth Power Off Screen.<br class="">
<br class="">
[[32m OK [0m] Stopped Dynamic System Tuning Daemon.<br
class="">
<br class="">
Aug 3 21:23:09 shao-redis-prd-base systemd: Stopped
Dynamic System Tuning Daemon.<br class="">
```<br class="">
<br class="">
It seems other system services are also start shutdown
at same time, is there a better to do this?<br class="">
<br class="">
Any advice is welcome.<br class="">
<br class="">
Thanks,<br class="">
<br class="">
</blockquote>
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">--<span
class="Apple-converted-space"> </span></span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Colin Guthrie</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">gmane(at)</span><a
href="http://colin.guthr.ie/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">colin.guthr.ie</a><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<a href="http://colin.guthr.ie/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">http://colin.guthr.ie/</a><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<br style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Day Job:</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class=""> Tribalogic Limited<span
class="Apple-converted-space"> </span></span><a
href="http://www.tribalogic.net/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">http://www.tribalogic.net/</a><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class="">Open Source:</span><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class=""> Mageia Contributor<span
class="Apple-converted-space"> </span></span><a
href="http://www.mageia.org/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">http://www.mageia.org/</a><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class=""> PulseAudio Hacker<span
class="Apple-converted-space"> </span></span><a
href="http://www.pulseaudio.org/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">http://www.pulseaudio.org/</a><br
style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; text-align: start; text-indent:
0px; text-transform: none; white-space: normal;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
text-decoration: none; float: none; display: inline
!important;" class=""> Trac Hacker<span
class="Apple-converted-space"> </span></span><a
href="http://trac.edgewall.org/" style="font-family:
Menlo-Regular; font-size: 18px; font-style: normal;
font-variant-caps: normal; font-weight: normal;
letter-spacing: normal; orphans: auto; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-size-adjust: auto;
-webkit-text-stroke-width: 0px;" class=""
moz-do-not-send="true">http://trac.edgewall.org/</a></div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Colin Guthrie
gmane(at)colin.guthr.ie
<a class="moz-txt-link-freetext" href="http://colin.guthr.ie/">http://colin.guthr.ie/</a>
Day Job:
Tribalogic Limited <a class="moz-txt-link-freetext" href="http://www.tribalogic.net/">http://www.tribalogic.net/</a>
Open Source:
Mageia Contributor <a class="moz-txt-link-freetext" href="http://www.mageia.org/">http://www.mageia.org/</a>
PulseAudio Hacker <a class="moz-txt-link-freetext" href="http://www.pulseaudio.org/">http://www.pulseaudio.org/</a>
Trac Hacker <a class="moz-txt-link-freetext" href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
</pre>
</body>
</html>