diff options
author | Christian Pointner <equinox@spreadspace.org> | 2019-12-23 23:43:43 +0100 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2019-12-23 23:43:43 +0100 |
commit | 416b590f88aea107a269f6a014e2519218852c78 (patch) | |
tree | b7e0b66f8b93bda561f4fa6e087ed78cb2ce0863 /roles/nextcloud/templates/nextcloud-occ.j2 | |
parent | fix network config of atlas based vms (diff) |
nextcloud: upgrade all instances and add occ script
Diffstat (limited to 'roles/nextcloud/templates/nextcloud-occ.j2')
-rwxr-xr-x | roles/nextcloud/templates/nextcloud-occ.j2 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/roles/nextcloud/templates/nextcloud-occ.j2 b/roles/nextcloud/templates/nextcloud-occ.j2 new file mode 100755 index 00000000..91977ccd --- /dev/null +++ b/roles/nextcloud/templates/nextcloud-occ.j2 @@ -0,0 +1,20 @@ +#!/bin/bash + +INST_NAME="$1" +shift + +if [ -z "$INST_NAME" ]; then + echo "Usage: $0 <instance> [ <arguments for occ.php> ... ]" + exit 1 +fi + +set -eu +export CONTAINER_RUNTIME_ENDPOINT="unix:///run/containerd/containerd.sock" + +pod_id=$(crictl pods -q --state ready --name "$INST_NAME-{{ ansible_nodename }}") +if [ -z "$pod_id" ]; then echo "Pod not found"; exit 1; fi + +container_id=$(crictl ps -q --name '^nextcloud$' -p "$pod_id") +if [ -z "$container_id" ]; then echo "Container not found"; exit 1; fi + +exec crictl exec -it "$container_id" php /var/www/html/occ $@ |