more thoughts

This commit is contained in:
jblu 2023-08-15 22:25:44 -05:00
parent e00a049ba7
commit d0e1100689
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
FROM alpine:latest
RUN apk add --no-cache mariadb-client rclone curl supercronic
RUN apk add --no-cache mariadb-client rclone curl supercronic docker
COPY entrypoint.sh opt
CMD ["/opt/entrypoint.sh"]

View File

@ -4,13 +4,14 @@
DATE=`date +%F`
TIME=`date +%H%M`
BACKUPDIR=/backup
SEAFDIR=/opt/seafile
# /shared/seafile in seafile container
SEAFDIR=/seafile
BACKUPFILE=$BACKUPDIR/seafile-$DATE-$TIME.tar
TEMPDIR=/tmp/seafile-$DATE-$TIME
BACKUPDATADIR=/backupdata
# Shutdown seafile
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seahub.sh stop
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seafile.sh stop
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seahub.sh stop
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seafile.sh stop
# Create directories
if [ ! -d $BACKUPDIR ]
@ -23,7 +24,6 @@ if [ ! -d $TEMPDIR ]
echo Create temporary directory $TEMPDIR...
mkdir -pm 0600 $TEMPDIR
mkdir -m 0600 $TEMPDIR/databases
mkdir -m 0600 $TEMPDIR/data
fi
# Dump data / copy data
@ -38,12 +38,12 @@ mysqldump -h $mysqlhost -u $mysqlusername -p $mysqlpassword --skip-opt seahub-db
if [ -e $TEMPDIR/databases/seahub-db.sql.* ]; then echo ok.; else echo ERROR.; fi
echo Copying seafile directory...
rsync -az $SEAFDIR/* $TEMPDIR/data
rclone sync $SEAFDIR/* $BACKUPDATADIR
if [ -d $TEMPDIR/data/seafile-data ]; then echo ok.; else echo ERROR.; fi
# Start the server
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seafile.sh start
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seahub.sh start-fastcgi
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seafile.sh start
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seahub.sh start
# compress data
echo Archive the backup...