mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
Merge pull request #463 from nextcloud/enh/459/only-one-session
make sure that only one session is active at a time
This commit is contained in:
commit
94f0a799fc
3 changed files with 32 additions and 0 deletions
|
|
@ -86,10 +86,12 @@ RUN mkdir /var/log/supervisord; \
|
||||||
COPY Caddyfile /
|
COPY Caddyfile /
|
||||||
COPY start.sh /usr/bin/
|
COPY start.sh /usr/bin/
|
||||||
COPY backup-time-file-watcher.sh /
|
COPY backup-time-file-watcher.sh /
|
||||||
|
COPY session-deduplicator.sh /
|
||||||
COPY cron.sh /
|
COPY cron.sh /
|
||||||
COPY supervisord.conf /
|
COPY supervisord.conf /
|
||||||
RUN chmod +x /usr/bin/start.sh; \
|
RUN chmod +x /usr/bin/start.sh; \
|
||||||
chmod +x /cron.sh; \
|
chmod +x /cron.sh; \
|
||||||
|
chmod +x /session-deduplicator.sh; \
|
||||||
chmod +x /backup-time-file-watcher.sh
|
chmod +x /backup-time-file-watcher.sh
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
|
||||||
23
Containers/mastercontainer/session-deduplicator.sh
Normal file
23
Containers/mastercontainer/session-deduplicator.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
while "$(find "/mnt/docker-aio-config/session/" -mindepth 1 -exec grep "aio_authenticated|[a-z]:1" {} \; | wc -l)" -gt 1; do
|
||||||
|
unset SESSION_FILES
|
||||||
|
SESSION_FILES="$(find "/mnt/docker-aio-config/session/" -mindepth 1)"
|
||||||
|
unset SESSION_FILES_ARRAY
|
||||||
|
mapfile -t SESSION_FILES_ARRAY <<< "$SESSION_FILES"
|
||||||
|
for SESSION_FILE in "${SESSION_FILES_ARRAY[@]}"; do
|
||||||
|
if ! grep -q "aio_authenticated|[a-z]:1" "$SESSION_FILE"; then
|
||||||
|
rm "$SESSION_FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Deleting duplicate sessions"
|
||||||
|
unset OLDEST_FILE
|
||||||
|
set -x
|
||||||
|
# shellcheck disable=SC2012
|
||||||
|
OLDEST_FILE="$(ls -t "/mnt/docker-aio-config/session/" | tail -1)"
|
||||||
|
rm "/mnt/docker-aio-config/session/$OLDEST_FILE"
|
||||||
|
set +x
|
||||||
|
done
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
@ -35,3 +35,10 @@ stdout_logfile_maxbytes=0
|
||||||
stderr_logfile=/dev/stderr
|
stderr_logfile=/dev/stderr
|
||||||
stderr_logfile_maxbytes=0
|
stderr_logfile_maxbytes=0
|
||||||
command=/backup-time-file-watcher.sh
|
command=/backup-time-file-watcher.sh
|
||||||
|
|
||||||
|
[program:session-deduplicator]
|
||||||
|
stdout_logfile=/dev/stdout
|
||||||
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
command=/session-deduplicator.sh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue