Permalink
Browse files

Added create mysql group and user if not exist

  • Loading branch information...
1 parent 7e8c5fd commit fcf73799261f6eb3c0ddf9790251d2f1cb7b873f @tamirko tamirko committed Jan 2, 2013
Showing with 14 additions and 10 deletions.
  1. +0 −2 services/apache/README.md
  2. +0 −2 services/apacheLB/README.md
  3. +0 −3 services/mysql/README.md
  4. +13 −2 services/mysql/install.sh
  5. +1 −1 services/mysql/uninstall.sh
@@ -24,8 +24,6 @@ Tested on:
* <strong>OpenStack</strong>:
* <strong>CentOs 5</strong>: imageId "1234" CentOS 5.6 64-bit, hardwareId "103" standard.large - 4 vCPU / 8 GB RAM / 240 GB HD , az-1.region-a.geo-1
-We disable the requiretty flag in /etc/sudoers on the installed VMs, so that Cloudify will be able to invoke remote ssh commands as a sudoer. This feature will be a part of Cloudify in the near future.
-Until then, please use the [Cloud Drivers Repository](https://github.com/CloudifySource/cloudify-cloud-drivers).
Synopsis
--------
@@ -27,8 +27,6 @@ Tested on:
* <strong>Rackspace</strong>:
* <strong>CentOs 6</strong>: imageId "118", hardwareId "4" (2GB server = 2G RAM 80 GB HD).
-We disable the requiretty flag in /etc/sudoers on the installed VMs, so that Cloudify will be able to invoke remote ssh commands as a sudoer. This feature will be a part of Cloudify in the near future.
-Until then, please use the [Cloud Drivers Repository](https://github.com/CloudifySource/cloudify-cloud-drivers).
Synopsis
--------
View
@@ -29,9 +29,6 @@ Tested on:
* <strong>Rackspace</strong>:
* <strong>CentOs 6</strong>: imageId "118", hardwareId "4" (2GB server = 2G RAM 80 GB HD).
- We disable the requiretty flag in /etc/sudoers on the installed VMs, so that Cloudify will be able to invoke remote ssh commands as a sudoer. This feature will be a part of Cloudify in the near future.
-Until then, please use the [Cloud Drivers Repository](https://github.com/CloudifySource/cloudify-cloud-drivers).
-
Synopsis
View
@@ -22,9 +22,9 @@ function error_exit {
}
function killMySqlProcess {
- ps -ef | grep -iE "mysql" | grep -ivE "gigaspaces|GSC|GSA|grep"
+ ps -ef | grep -iE "mysql" | grep -ivE "install|gigaspaces|GSC|GSA|grep"
if [ $? -eq 0 ] ; then
- ps -ef | grep -iE "mysql" | grep -ivE "gigaspaces|GSC|GSA|grep" | awk '{print $2}' | xargs sudo kill -9
+ ps -ef | grep -iE "mysql" | grep -ivE "install|gigaspaces|GSC|GSA|grep" | awk '{print $2}' | xargs sudo kill -9
fi
}
@@ -55,6 +55,17 @@ sudo rm -rf /etc/my.cnf || error_exit $? "Failed on: sudo rm -rf /etc/my.cnf"
sudo rm -rf /var/log/mysql* || error_exit $? "Failed on: sudo rm -rf /var/log/mysql*"
#sudo rm -f /home/`whoami`/{.,}*mysql* || error_exit $? "Failed on: sudo rm -f /home/`whoami`/{.,}*mysql*"
+groupExists=`grep -c mysql /etc/group`
+
+if [ $groupExists -eq 0 ] ; then
+ groupadd mysql
+fi
+
+userExists=`grep -c "mysql" /etc/passwd`
+if [ $userExists -eq 0 ] ; then
+ useradd mysql -g mysql
+fi
+
echo "Using yum. Installing mysql on one of the following : Red Hat, CentOS, Fedora, Amazon"
# This master-slave implementation requires mysql5.1+ version.
@@ -23,7 +23,7 @@ echo "#1 Killing old mysql process if exists..."
killMySqlProcess
echo "Removing previous mysql installation if exists..."
-sudo yum -y -q remove mysql mysql-server
+sudo yum -y -q remove mysql* mysql-server
# The following two statements are used since in some cases, there are leftovers after uninstall
echo "Removing old stuff if exists..."

0 comments on commit fcf7379

Please sign in to comment.