Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Added create mysql group and user if not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamir Korem committed Jan 2, 2013
1 parent 7e8c5fd commit fcf7379
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 0 additions & 2 deletions services/apache/README.md
Expand Up @@ -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
--------
Expand Down
2 changes: 0 additions & 2 deletions services/apacheLB/README.md
Expand Up @@ -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
--------
Expand Down
3 changes: 0 additions & 3 deletions services/mysql/README.md
Expand Up @@ -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
Expand Down
15 changes: 13 additions & 2 deletions services/mysql/install.sh
Expand Up @@ -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
}

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion services/mysql/uninstall.sh
Expand Up @@ -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..."
Expand Down

0 comments on commit fcf7379

Please sign in to comment.