HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/fagottube.com/wpscript.sh
#!/bin/bash

echo "Enter a database/username: "

read name 

#echo "Downloading the latest version of wordpress..."
#wget --quiet -O - wordpress.org/latest.tar.gz | tar -v -z -x --strip-components=1 >& /dev/null

echo "Updating config file..."
password=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
cat wp-config-sample.php |sed -e "s/putyourdbnamehere/$name/g;s/usernamehere/$name/g;s/yourpasswordhere/$password/g" > wp-config.php

echo "Creating database..."
echo "create database $name" | mysql
echo "grant all on $name.* to $name@'localhost' identified by '$password'" | mysql $name

user=`pwd|awk -F\/ '{print $4}'`

echo chown $user.www-data `pwd` -R \* [y/n]:
read answer

if [ $answer == "y" ]
then
 chown $user.www-data `pwd` -R *
fi

echo chmod g+w `pwd`/wp-content [y/n]:
read answer

if [ $answer == "y" ]
then
 chmod g+w `pwd`/wp-content
fi

echo "done."

echo "db name: $name"
echo "db user: $name"
echo "db pass: $password"

echo ""