Skip to content
Snippets Groups Projects
Commit 94c84d71 authored by tee's avatar tee
Browse files

add old scripts from v2.4

parent e66fbbe7
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
docker exec -itu postgres greenlight_db_1 psql $*
#!/bin/bash
# backup the greenlight postgres dbs
# (c) 2020-2038 cc-by-nc-sa wotwot
now=`date +%Y%m%d-%H%M`
host=`hostname -s`
file="postgres-${host}-${now}-greenlight-only.sql"
dir="/var/backups/postgresql"
dbname="greenlight_db_1"
if [ ! -d "$dir" ] ; then
echo "no $dir, making one"
mkdir $dir
fi
cd /root/greenlight || \
{
echo "greenlight not found"
exit
}
#docker ps || exit
docker exec -u postgres ${dbname} pg_dump greenlight_production -c > ${dir}/${file}
#!/bin/bash
# backup the greenlight postgres dbs
# (c) 2020-2038 cc-by-nc-sa wotwot
now=`date +%Y%m%d-%H%M`
host=`hostname -s`
file="postgres-${host}-${now}-greenlight-only.sql"
dir="/var/backups/postgresql"
dbname="greenlight_db_1"
if [ ! -d "$dir" ] ; then
echo "no $dir, making one"
mkdir $dir
fi
cd /root/greenlight || \
{
echo "greenlight not found"
exit
}
#docker ps || exit
docker exec -u postgres ${dbname} pg_dumpall > ${dir}/${file}
docker exec -u postgres ${dbname} pg_dump greenlight_production > ${dir}/${file}
#!/bin/sh
file=$*
if [ -z "$file" ] ; then
echo "ouch wot ?"
exit
fi
# docker exec -u postgres greenlight_db_1 psql postgres < ../bbb-postgres-20200514.sql
# docker exec -u postgres greenlight_db_1 psql greenlight_production < ../bbb-greenlight_production-20200514.sql
docker exec -u postgres greenlight_db_1 psql < $file
#!/bin/bash
# restore a greenlight postgres db from a textdump
# (c) 2020-2038 cc-by-nc-sa wotwot
file=$1
if [ -z "$file" ] ; then
echo "nah. tell me the full path to the file to replace the greenlight db with" > /dev/stderr
exit
else
if [ ! -f "$file" ] ; then
echo "file not found" > /dev/stderr
exit
fi
fi
dbname="greenlight_db_1"
cd /root/greenlight || \
{
echo "greenlight not found"
exit
}
echo "docker exec -u postgres ${dbname} psql greenlight_production < $file"
docker exec -u postgres ${dbname} psql greenlight_production < $file
#!/bin/sh
docker exec -it greenlight-v2 bash
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment