2018-12-02 02:08:31 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2019-06-21 02:15:55 +02:00
|
|
|
if [[ ! -z "$NEXTCLOUD_PROJECT_NAME" ]]; then
|
2022-03-19 20:00:38 +01:00
|
|
|
containerName="${NEXTCLOUD_PROJECT_NAME}[_-]"
|
2019-06-21 02:15:55 +02:00
|
|
|
else
|
2022-03-19 20:00:38 +01:00
|
|
|
matchEnd="(,|\.\d+)"
|
2019-06-21 02:15:55 +02:00
|
|
|
fi
|
2018-12-02 02:08:31 +01:00
|
|
|
|
2019-06-21 02:15:55 +02:00
|
|
|
containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}"
|
|
|
|
|
|
|
|
# Get the ID of the container so we can exec something in it later
|
2018-12-02 02:08:31 +01:00
|
|
|
docker ps --format '{{.Names}},{{.ID}}' | \
|
|
|
|
egrep "^${containerName}${matchEnd}" | \
|
|
|
|
awk '{split($0,a,","); print a[2]}'
|