Skip to content
Snippets Groups Projects
Verified Commit 7ac472b5 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

feat: change entrypoint to be designed for jobs/cronjobs instead

parent cdfc905f
Branches
No related tags found
No related merge requests found
......@@ -12,6 +12,12 @@ RUN apt-get update && \
ADD docker-entrypoint.sh /docker-entrypoint.sh
RUN addgroup --system --gid 1000 seafile-sync && \
adduser --system --ingroup seafile-sync --uid 1000 --shell /bin/sh --home /config seafile-sync
USER seafile-sync
ENV TASK="sync"
ENV LIBRARY=""
ENV SERVER=""
ENV EMAIL=""
......
......@@ -3,41 +3,21 @@ set -Eeo pipefail
trap "exit" INT
seaf-cli init -d /seafile-data
mkdir -p ~/seafile
seaf-cli init -d ~/seafile
seaf-cli start
tail -f ~/.ccnet/logs/seafile.log &
until [ -S /seafile-data/seafile-data/seafile.sock ]; do
sleep 1;
done
if [ -z "$OTP_TOKEN" ]; then
echo "syncing library"
date
seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD"
seaf-cli "$TASK" -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD"
else
echo "syncing library with OTP"
date
seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" --tfa $(oathtool --totp -b "$OTP_TOKEN")
seaf-cli "$TASK" -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" --tfa $(oathtool --totp -b "$OTP_TOKEN")
fi
maxretry=4
retry=0
lastoutput=""
output=""
while [ "$retry" -le "$maxretry" ]; do
ps aux | grep seafile | grep -v grep > /dev/null 2> /dev/null || {
retry=$(expr $retry + 1);
}
output=$(seaf-cli status)
if [[ "$output" != "$lastoutput" ]]; then
date
echo "$output"
lastoutput="$output"
fi
until seaf-cli status | grep synchronized; do
seaf-cli status
sleep 5
done
echo "Seafile not running"
exit 1
seaf-cli stop
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment