Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions doc/rtd/explanation/format/mime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,27 @@ Create user-data containing 3 shell scripts:

$ cloud-init devel make-mime -a always.sh:x-shellscript-per-boot -a instance.sh:x-shellscript-per-instance -a once.sh:x-shellscript-per-once

Per-frequency shell scripts
Comment thread
Ahmedaltu marked this conversation as resolved.
---------------------------

Cloud-init supports three MIME content types for controlling how often a
shell script runs, corresponding to the run frequencies described in
:ref:`module_frequency`:

Comment thread
Ahmedaltu marked this conversation as resolved.
``text/x-shellscript-per-boot``
The script runs on **every boot**. Useful for tasks that must be
repeated each time the instance starts, such as mounting ephemeral
storage or refreshing dynamic configuration.

``text/x-shellscript-per-instance``
The script runs **once per instance-id**. A new instance-id is
assigned each time a new instance is provisioned.

``text/x-shellscript-per-once``
The script runs **once**, tracked by a semaphore in
:file:`/var/lib/cloud/sem`. If cloud-init state is preserved — for
example, when an image is created from a running instance — the
semaphore persists and the script will not run again on instances
booted from that image.

Comment thread
Ahmedaltu marked this conversation as resolved.
.. _make-mime: https://github.com/canonical/cloud-init/blob/main/cloudinit/cmd/devel/make_mime.py
Loading