Skip to main content

Lifecycle scripts overview


Crusoe Cloud is currently in alpha. If you do not currently have access, please request access to continue.

Lifecycle scripts allow you to react to VM state changes, either a VM starting up or a VM shutting down, by running a shell script.

Startup scripts are run on VM boot after the network is accessible, and can run for an indefinite amount of time. Shutdown scripts are run when the VM gets a ACPI shutdown signal, and will run for up to 90 seconds, after which the VM will be terminated. Scripts run as root and execute in the root directory (/).

Creating lifecycle scripts

In order to create a lifecycle script, you need to create a VM with the script(s):

Use the vm create command to create a VM of your choice and pass in the path to a local script

crusoe vm create \
--name my-vm \
--type a40.1x \
--keyfile ~/.ssh/ \
--startup-script ~/path/to/ \
--shutdown-script ~/path/to/

Modifying lifecycle scripts

Once a lifecycle script is created, you can modify the script directly on the VM by editing the files in /usr/local/bin/crusoe. Changes to this script take effect immediately on the next shutdown or startup.


Lifecycle scripts are subject to the following limitations:

  • Scripts must be in bash (has to start with #!/bin/bash)
  • Scripts must be less than 64kB in size
  • Scripts may only contain ASCII characters