Skip to content

Commit

Permalink
Update startup/shutdown services to launch compat manager
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaitanyaKulkarni28 committed Feb 21, 2025
1 parent 279293e commit 462c8cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion google-shutdown-scripts.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Type=oneshot
ExecStart=/bin/true
RemainAfterExit=true
# This service does nothing on start, and runs shutdown scripts on stop.
ExecStop=/usr/bin/google_metadata_script_runner shutdown
ExecStop=/bin/sh -c 'if [ -e /usr/bin/gce_compat_metadata_script_runner ]; then /usr/bin/gce_compat_metadata_script_runner shutdown; else /usr/bin/google_metadata_script_runner shutdown; fi'
TimeoutStopSec=0
KillMode=process

Expand Down
2 changes: 1 addition & 1 deletion google-startup-scripts.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Before=apt-daily.service

[Service]
Type=oneshot
ExecStart=/usr/bin/google_metadata_script_runner startup
ExecStart=/bin/sh -c 'if [ -e /usr/bin/gce_compat_metadata_script_runner ]; then /usr/bin/gce_compat_metadata_script_runner startup; else /usr/bin/google_metadata_script_runner startup; fi'
#TimeoutStartSec is ignored for Type=oneshot service units.
KillMode=process
StandardOutput=journal+console
Expand Down
6 changes: 5 additions & 1 deletion packaging/googet/run_shutdown_scripts.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ REM limitations under the License.
REM Run shutdown scripts that should happen as soon as the instance
REM begins to power down

"C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe" "shutdown"
IF EXIST "C:\Program Files\Google\Compute Engine\metadata_scripts\GCECompatMetadataScripts.exe" (
"C:\Program Files\Google\Compute Engine\metadata_scripts\GCECompatMetadataScripts.exe" "shutdown"
) ELSE (
"C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe" "shutdown"
)
6 changes: 5 additions & 1 deletion packaging/googet/run_startup_scripts.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ REM A scheduled task may only run for up to three days before termination.
REM We execute the startup script asynchronously so it may run without
REM this three day maximum runtime limitation.

start "" "C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe" "startup"
IF EXIST "C:\Program Files\Google\Compute Engine\metadata_scripts\GCECompatMetadataScripts.exe" (
start "" "C:\Program Files\Google\Compute Engine\metadata_scripts\GCECompatMetadataScripts.exe" "startup"
) ELSE (
start "" "C:\Program Files\Google\Compute Engine\metadata_scripts\GCEMetadataScripts.exe" "startup"
)

0 comments on commit 462c8cb

Please sign in to comment.