Newer
Older
wordpress / generate_password.sh
@Pascal Gollor Pascal Gollor on 24 Dec 2017 411 bytes first commit
#!/bin/bash

if [ ! -f "wordpress.conf" ]; then
	cp wordpress.con.example wordpress.conf

	pw1=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)
	pw2=$(</dev/urandom tr -dc A-Za-z0-9 | head -c 28)

	sed -i "/^WORDPRESS_DATABASE_ROOT/c\\\WORDPRESS_DATABASE_ROOT=${pw1}" wordpress.conf
	sed -i "/^WORDPRESS_DATABASE_PASSWORD/c\\\WORDPRESS_DATABASE_PASSWORD=${pw2}" wordpress.conf
else
	echo "fiel already exists"
fi