Enable a command to be run on machine shutdown

Bug #1609864 reported by Dan Watkins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Low
Unassigned

Bug Description

Google Compute Engine support running scripts as an instance is being shutdown, which is currently implemented using a oneshot service that has RemainAfterExit=true and an ExecStop command set[0].

We will need to be able to specify commands to run on shutdown of a machine in order to snap up GCE's agent packages.

[0] https://github.com/GoogleCloudPlatform/compute-image-packages/blob/master/google_compute_engine_init/systemd/google-shutdown-scripts.service

Tags: cpc
Dan Watkins (oddbloke)
tags: added: cpc
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Dear reporter, the link in the bug report does not work. Could you please revise the description of the bug to update the link. How is this handled outside of the context of snaps? That is, how does one otherwise run a service on system shutdown?

affects: snappy → snapd
Changed in snapd:
status: New → Triaged
importance: Undecided → Wishlist
status: Triaged → Incomplete
importance: Wishlist → Low
Revision history for this message
Ian Johnson (anonymouse67) wrote :

The correct link seems to be https://github.com/GoogleCloudPlatform/compute-image-packages/blob/fa80cdb23df0a7e190e228a9d9d379922d1f0764/packages/google-compute-engine/src/lib/systemd/system/google-shutdown-scripts.service

AFAICT, the way most services do this is to have the command you want to run in ExecStop, then have RemainAfterExit=true which means that the service is always considered active and thus ExecStop only gets run when the system is shut down.

This seems a reasonable feature request for snapd, but admittedly is probably low priority right now.

Changed in snapd:
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.