[pve-devel] [PATCH v2 pve-docs 2/3] Add hookscript section to container documentation

Stefan Hanreich s.hanreich at proxmox.com
Thu Oct 6 14:44:44 CEST 2022


Since it has been missing so far, I extended the documentation to
contain information about container hookscripts. I added some additional
notes for how to use the pre/post-migrate scripts properly.

Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 pct.adoc | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/pct.adoc b/pct.adoc
index ebae3e9..57f2206 100644
--- a/pct.adoc
+++ b/pct.adoc
@@ -1260,3 +1260,26 @@ Configuration file for the container '<CTID>'.
 
 include::pve-copyright.adoc[]
 endif::manvolnum[]
+
+Hookscripts
+-----------
+
+You can add a hook script to CTs with the config property `hookscript`.
+
+----
+# pct set 100 --hookscript local:snippets/hookscript.pl
+----
+
+It will be called during various phases of the guests lifetime.
+For an example and documentation see the example script under
+`/usr/share/pve-docs/examples/guest-example-hookscript.pl`.
+
+pre/post-migrate
+~~~~~~~~~~~~~~~~
+Those hooks run before/after a CT migrates from one host to another. This
+hook is a bit special, since it gets executed on the source node as well as the
+target node. In order for this hookscript to function properly, the configured
+script file needs to be available on both nodes. If it is a local script, this
+means storing it on both server under the same path. The preferred option
+would be storing the hookscript on a shared storage, so it is accessible from
+both nodes.
-- 
2.30.2





More information about the pve-devel mailing list