1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_ynh.git synced 2024-09-03 18:36:10 +02:00

Update _common.sh

This commit is contained in:
ericgaspar 2021-10-01 14:13:35 +02:00
parent d0fae45719
commit 4b220e1d42
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -52,8 +52,7 @@ ynh_redis_get_free_db() {
echo "$db"
}
# Create a master password and set up global settings
# Please always call this script in install and restore scripts
# Flush Redis key
#
# usage: ynh_redis_remove_db database
# | arg: database - the database to erase
@ -61,3 +60,21 @@ ynh_redis_remove_db() {
local db=$1
redis-cli -n "$db" flushall
}
dump_location=/var/lib/redis/dump.rdb
#destination=/tmp/dump-$(date +"%Y%m%d").rdb
# Restore a database
#
ynh_redis_restore_db() {
cat $dump_location | redis-cli -x restore mykey $ynh_redis_get_free_db
}
# Dump a database
#
ynh_redis_dump_db() {
redis-cli SET mykey $db
redis-cli --raw dump mykey | head -c-1 > $dump_location
}