[systemd-devel] Cannot get Shutdown Script to Run (Libvirt Virtual Machine Shutdown)

"Jóhann B. Guðmundsson" johannbg at gmail.com
Thu Oct 9 14:49:58 PDT 2014


On 10/09/2014 08:28 PM, "Jóhann B. Guðmundsson" wrote:
>
> What I dont understand what's the usecase for somekind of ExecStop= 
> modfications, why do we need to do that? 

Note that the Before= in the test script is failing to pass which 
indicates something is borked in the ordering

I added the Before= line in shutdown-test.service

[Unit]
Description=My Shutdown Test
Before=httpd.service shutdown.target
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/bin/systemd-cat -t "SHUTDOWN" /bin/echo "Systemd shutdown test-4"

[Install]
WantedBy=shutdown.target

And added this line to the httpd.service

ExecStop=/bin/systemd-cat -t "SHUTDOWN" /bin/echo "Systemd shutdown 
test-4 after shutdown-test.service"

Rebooted and as you can see the shutdown-test.service is being run 
*after* the httpd.service not before...

Oct 09 21:11:15 localhost.localdomain SHUTDOWN[2098]: Systemd shutdown 
test-4 after shutdown-test.service
Oct 09 21:11:16 localhost.localdomain SHUTDOWN[2108]: Systemd shutdown 
test-4

Expected result,  shutdown-test.service being run before httpd.service 
as in...

Oct 09 21:11:15 localhost.localdomain SHUTDOWN[2108]: Systemd shutdown 
test-4
Oct 09 21:11:16 localhost.localdomain SHUTDOWN[2098]: Systemd shutdown 
test-4 after shutdown-test.service
( systemd-208-22.fc20.x86_64 which probably means the dracut and alsa 
units that are tied to the shutdown.target aren't working as expected )

Perhaps that bug is the reason you think we need somekind of ExecStop= 
modfications?

JBG


More information about the systemd-devel mailing list