mirror of
https://git.qoto.org/m33/misskey-admin-scripts-n-tips.git
synced 2024-10-22 23:19:08 +00:00
load scripts
This commit is contained in:
parent
acc055f396
commit
443c221ff1
3 changed files with 41 additions and 0 deletions
28
backup_postgres.sh
Executable file
28
backup_postgres.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# A daily backup for your docker postgresql database, run it daily
|
||||||
|
# It will cycle with the day of week (1..7)
|
||||||
|
#
|
||||||
|
DT=`date +%w`
|
||||||
|
|
||||||
|
### You will need to adjust DST and DOCKER_ENV Paths ###
|
||||||
|
# Backup destination directory
|
||||||
|
DST=/usr/local/backup
|
||||||
|
# Docker env file from Misskey
|
||||||
|
DOCKER_ENV=/usr/local/misskey/data/.config/docker.env
|
||||||
|
###
|
||||||
|
|
||||||
|
source $DOCKER_ENV || exit 1
|
||||||
|
|
||||||
|
mkdir -p $DST
|
||||||
|
cd $DST || exit 1
|
||||||
|
|
||||||
|
# Get the posgres container ID
|
||||||
|
pgcont=`get_container_id.sh postgres` || exit 1
|
||||||
|
|
||||||
|
# Dump quick, compress later
|
||||||
|
docker exec -i $pgcont pg_dump -U $POSTGRES_USER $POSTGRES_DB > backup-$POSTGRES_DB.$DT.pgsql
|
||||||
|
|
||||||
|
nice xz --force backup-$POSTGRES_DB.$DT.pgsql
|
||||||
|
|
||||||
|
exit $?
|
7
cleanup_docker.sh
Executable file
7
cleanup_docker.sh
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Prune all orphaned images, and stopped containers
|
||||||
|
#
|
||||||
|
docker container prune
|
||||||
|
docker image prune -a
|
||||||
|
exit $?
|
6
get_container_id.sh
Executable file
6
get_container_id.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Get container ID from name
|
||||||
|
#
|
||||||
|
docker container ls|grep "$1"|awk '{print $1}'|grep -v CONTAINER
|
||||||
|
exit $?
|
Loading…
Reference in a new issue