remove write info for mysql db, info is alwasy written now
This commit is contained in:
parent
05172002df
commit
6257436bc6
|
@ -21,7 +21,7 @@ help()
|
|||
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
||||
echo " -x <fpmmax> PHP-FPM pm.max_children. Optional, defaults to 4, recommended range 2-12 on Shared Server."
|
||||
echo " -j <0|1> Whether or not to jail the user. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||
echo " -w <0|1> Write user & mysql info to files. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||
echo " -w <0|1> Write user info to /home/username/.passwd. 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -121,4 +121,4 @@ fi
|
|||
/usr/local/bin/vhost-add.sh -d $domain -u $username > /dev/null 2>&1
|
||||
|
||||
# add mysql database
|
||||
/usr/local/bin/vhost-mysql-db-add.sh -d $domain -w $write> /dev/null 2>&1
|
||||
/usr/local/bin/vhost-mysql-db-add.sh -d $domain> /dev/null 2>&1
|
||||
|
|
|
@ -19,8 +19,6 @@ help()
|
|||
echo " -d <domain> Domain name of VirtualHost to add db for."
|
||||
echo " -u <username> Username for accessing the database. Optional, autogenerated if none specified."
|
||||
echo " -p <password> Password for username. Optional, random password generated if none specified."
|
||||
echo " -w <0|1> Write db info to /srv/www/domain/.my.cnf and create include in /home/username/.my.cnf."
|
||||
echo " 0 = no, 1 = yes. Default is 1, which can be overridden in main config."
|
||||
echo " -v Verbose - output newly created db info to console."
|
||||
echo ""
|
||||
echo " MySQL database names is based on virtualhost with . replaced by the word 'dot'"
|
||||
|
@ -28,7 +26,6 @@ help()
|
|||
echo " the shell username & the virtualhost name."
|
||||
echo " e.g. for virtualost example.com the db name will be 'exampledotcom' and the"
|
||||
echo " username will be examplec@example.com."
|
||||
echo " It is highly recommended to use either the -w or -v option if you don't use -p."
|
||||
}
|
||||
|
||||
vhost:getoptions "$@"
|
||||
|
@ -79,23 +76,21 @@ mysql -e "GRANT ALL PRIVILEGES ON $database.* TO '$username'@'localhost';"
|
|||
mysqladmin flush-privileges
|
||||
|
||||
# save mysql db info to file
|
||||
if [[ $write == 1 ]]; then
|
||||
touch /srv/www/$domain/.my.cnf
|
||||
chown $vhost_username:$vhost_username /srv/www/$domain/.my.cnf
|
||||
chmod 640 /srv/www/$domain/.my.cnf
|
||||
echo '[client]' > /srv/www/$domain/.my.cnf
|
||||
echo "host=127.0.0.1" >> /srv/www/$domain/.my.cnf
|
||||
echo "user=$username" >> /srv/www/$domain/.my.cnf
|
||||
echo "password=$password" >> /srv/www/$domain/.my.cnf
|
||||
echo '[mysql]' >> /srv/www/$domain/.my.cnf
|
||||
echo "database=$database" >> /srv/www/$domain/.my.cnf
|
||||
touch /home/$vhost_username/.my.cnf
|
||||
chown $vhost_username:$vhost_username /home/$vhost_username/.my.cnf
|
||||
chmod 640 /home/$vhost_username/.my.cnf
|
||||
if [[ ! -f /home/$vhost_username/.my.cnf ]]; then
|
||||
echo "#[client]" > /home/$vhost_username/.my.cnf
|
||||
echo '!include' "/srv/www/$domain/.my.cnf" >> /home/$vhost_username/.my.cnf
|
||||
fi
|
||||
touch /srv/www/$domain/.my.cnf
|
||||
chown $vhost_username:$vhost_username /srv/www/$domain/.my.cnf
|
||||
chmod 640 /srv/www/$domain/.my.cnf
|
||||
echo '[client]' > /srv/www/$domain/.my.cnf
|
||||
echo "host=127.0.0.1" >> /srv/www/$domain/.my.cnf
|
||||
echo "user=$username" >> /srv/www/$domain/.my.cnf
|
||||
echo "password=$password" >> /srv/www/$domain/.my.cnf
|
||||
echo '[mysql]' >> /srv/www/$domain/.my.cnf
|
||||
echo "database=$database" >> /srv/www/$domain/.my.cnf
|
||||
touch /home/$vhost_username/.my.cnf
|
||||
chown $vhost_username:$vhost_username /home/$vhost_username/.my.cnf
|
||||
chmod 640 /home/$vhost_username/.my.cnf
|
||||
if [[ ! -f /home/$vhost_username/.my.cnf ]]; then
|
||||
echo "#[client]" > /home/$vhost_username/.my.cnf
|
||||
echo '!include' "/srv/www/$domain/.my.cnf" >> /home/$vhost_username/.my.cnf
|
||||
fi
|
||||
|
||||
if [[ -n $verbose ]]; then
|
||||
|
|
Loading…
Reference in New Issue
Block a user