Skip to content

Commit

Permalink
fix disaster recovery memcached user creation, add mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Mar 1, 2024
1 parent 5641ea3 commit 39c1ae2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions scripts/disaster-recovery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,29 @@ EOF
}

memcached_user_setup() {
if ! getent group memcached >/dev/null; then
if ! getent group | cut -d: -f3 | grep -qx '11211'; then
echo "creating memcached group"
groupadd -g 11211 memcached
fi

if ! id -u memcached >/dev/null 2>&1; then
if ! getent passwd | cut -d: -f3 | grep -qx '11211'; then
echo "creating memcached user"
useradd -u 11211 -g memcached memcached
fi
}

mysql_user_setup() {
if ! getent group | cut -d: -f3 | grep -qx '1001'; then
echo "creating mysql group"
groupadd -g 1001 mysql
fi

if ! getent passwd | cut -d: -f3 | grep -qx '1001'; then
echo "creating mysql user"
useradd -u 1001 -g mysql mysql
fi
}

set_up_duplicity() {
command -v duplicity >/dev/null && return
echo "installing duplicity for backups..."
Expand Down Expand Up @@ -277,6 +289,7 @@ zabbix_setup
set_up_duplicity
setup_aws
memcached_user_setup
mysql_user_setup

# Backup restoration
backup_restore
Expand Down

0 comments on commit 39c1ae2

Please sign in to comment.