diff --git a/Dockerfile.multiarches b/Dockerfile.multiarches index 78e25c9..f84f731 100644 --- a/Dockerfile.multiarches +++ b/Dockerfile.multiarches @@ -42,6 +42,8 @@ EXPOSE 1337/tcp COPY config.yaml /config COPY var/entities/* /config/entities/ +COPY examples/backupScript.sh /opt/backupScript.sh +RUN chmod 755 /opt/backupScript.sh VOLUME /config ARG TARGETPLATFORM diff --git a/Dockerfile.singlearch b/Dockerfile.singlearch index 8337f75..e432f87 100644 --- a/Dockerfile.singlearch +++ b/Dockerfile.singlearch @@ -35,6 +35,8 @@ EXPOSE 1337/tcp COPY config.yaml /config COPY var/entities/* /config/entities/ +COPY examples/backupScript.sh /opt/backupScript.sh +RUN chmod 755 /opt/backupScript.sh VOLUME /config COPY OliveTin /usr/bin/OliveTin diff --git a/examples/backupScript.sh b/examples/backupScript.sh new file mode 100755 index 0000000..a4545b2 --- /dev/null +++ b/examples/backupScript.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +echo "Starting backup script" + +# Demo behaviour: 50% finish in 9 seconds (within the 10s action timeout), +# 50% run for 15 seconds (typically times out). +if (( RANDOM % 2 == 0 )); then + maxFiles=9 + echo "Demo: backup will finish in 9 seconds" +else + maxFiles=15 + echo "Demo: backup will run for 15 seconds (may exceed the action timeout)" +fi + +for fileIndex in $(seq 1 "$maxFiles"); do + echo "Backing up file: $fileIndex" + sleep 1 +done + +echo "All files backed up"