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

Fix bash script

parent 18027a34
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeo pipefail set -Eeo pipefail
trap "exit" INT
mkdir /seafile-data mkdir /seafile-data
seaf-cli init -d /seafile-data seaf-cli init -d /seafile-data
seaf-cli start
sleep 5
if [ -z "$OTP_TOKEN" ]; then if [ -z "$OTP_TOKEN" ]; then
echo "syncing library"
seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD"
else else
echo "syncing library with OTP"
seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" --tfa $(oathtool --totp -b "$OTP_TOKEN") seaf-cli sync -l "$LIBRARY" -s "$SERVER" -d "/sync" -u "$EMAIL" -p "$PASSWORD" --tfa $(oathtool --totp -b "$OTP_TOKEN")
fi fi
seaf-cli start
maxretry=4 maxretry=4
retry=0 retry=0
...@@ -17,6 +24,7 @@ while [ "$retry" -le "$maxretry" ]; do ...@@ -17,6 +24,7 @@ while [ "$retry" -le "$maxretry" ]; do
ps aux | grep seafile | grep -v grep > /dev/null 2> /dev/null || { ps aux | grep seafile | grep -v grep > /dev/null 2> /dev/null || {
retry=$(expr $retry + 1); retry=$(expr $retry + 1);
} }
seaf-cli status
sleep 5 sleep 5
done done
echo "Seafile not running" echo "Seafile not running"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment