summaryrefslogtreecommitdiff
path: root/roles/elevate/media/templates/nextcloud-occ.j2
blob: 2abde3078f4208e6dd8f0f71d3aa3a625fcb2a15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

INST_NAME="$1"
shift

if [ -z "$INST_NAME" ]; then
  echo "Usage: $0 <instance> [ <arguments for occ.php> ... ]"
  exit 1
fi

CRICTL_EXEC_ARGS="-it"
if [ -n "${NEXTCLOUD_OCC_NON_INTERACTIVE}" ]; then
  CRICTL_EXEC_ARGS=""
fi

set -eu

pod_id=$(crictl pods -q --state ready --name "^nextcloud-$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 $CRICTL_EXEC_ARGS "$container_id" php /var/www/html/occ $@