more thoughts
This commit is contained in:
parent
e00a049ba7
commit
d0e1100689
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:latest
|
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
|
COPY entrypoint.sh opt
|
||||||
CMD ["/opt/entrypoint.sh"]
|
CMD ["/opt/entrypoint.sh"]
|
@ -4,13 +4,14 @@
|
|||||||
DATE=`date +%F`
|
DATE=`date +%F`
|
||||||
TIME=`date +%H%M`
|
TIME=`date +%H%M`
|
||||||
BACKUPDIR=/backup
|
BACKUPDIR=/backup
|
||||||
SEAFDIR=/opt/seafile
|
# /shared/seafile in seafile container
|
||||||
|
SEAFDIR=/seafile
|
||||||
BACKUPFILE=$BACKUPDIR/seafile-$DATE-$TIME.tar
|
BACKUPFILE=$BACKUPDIR/seafile-$DATE-$TIME.tar
|
||||||
TEMPDIR=/tmp/seafile-$DATE-$TIME
|
TEMPDIR=/tmp/seafile-$DATE-$TIME
|
||||||
|
BACKUPDATADIR=/backupdata
|
||||||
# Shutdown seafile
|
# Shutdown seafile
|
||||||
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seahub.sh stop
|
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seahub.sh stop
|
||||||
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seafile.sh stop
|
docker exec $seafilecontainer /opt/seafile/seafile-server-latest/seafile.sh stop
|
||||||
|
|
||||||
# Create directories
|
# Create directories
|
||||||
if [ ! -d $BACKUPDIR ]
|
if [ ! -d $BACKUPDIR ]
|
||||||
@ -23,7 +24,6 @@ if [ ! -d $TEMPDIR ]
|
|||||||
echo Create temporary directory $TEMPDIR...
|
echo Create temporary directory $TEMPDIR...
|
||||||
mkdir -pm 0600 $TEMPDIR
|
mkdir -pm 0600 $TEMPDIR
|
||||||
mkdir -m 0600 $TEMPDIR/databases
|
mkdir -m 0600 $TEMPDIR/databases
|
||||||
mkdir -m 0600 $TEMPDIR/data
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Dump data / copy data
|
# 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
|
if [ -e $TEMPDIR/databases/seahub-db.sql.* ]; then echo ok.; else echo ERROR.; fi
|
||||||
|
|
||||||
echo Copying seafile directory...
|
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
|
if [ -d $TEMPDIR/data/seafile-data ]; then echo ok.; else echo ERROR.; fi
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
docker exec $seafilecontainer $SEAFDIR/seafile-server-latest/seafile.sh start
|
docker exec $seafilecontainer /opt/seafile/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/seahub.sh start
|
||||||
|
|
||||||
# compress data
|
# compress data
|
||||||
echo Archive the backup...
|
echo Archive the backup...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user