From 16a1437eec118e34936165aab79de74c5a95dbef Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sun, 27 Jan 2013 06:08:29 +0000 Subject: [PATCH] * rewrite the start scripts, add the judge of /opt/lampp directory and init scripts. --- build/linux/start | 32 +++++++++++++++++++++++++++----- build/linux/start88 | 32 +++++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/build/linux/start b/build/linux/start index 6be1c8f7d9..4e28740ce2 100644 --- a/build/linux/start +++ b/build/linux/start @@ -1,29 +1,51 @@ #!/bin/bash +# This file is used to start apache at 80 port and mysql at 3306 port. + +# check the directory, must at /opt/lampp. +pwd | grep ^/opt/lampp > /dev/null 2>&1 # check the pwd is /opt/lampp or not. +if [ $? -ne 0 ] +then + # if the pwd is not /opt/lampp, may be the /opt/lampp is a link, check /opt/lampp exists or not. + ls /opt/lampp > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "The lampp can only run at /opt/lampp" + fi +fi + +# check the run user, must be root. if test "`id -u`" -ne 0 then echo "You need to start XAMPP as root!" exit fi +# replace ports. sed -e 's/88/80/g' lampp | sed -e 's/3308/3306/g'> lampp.80 mv lampp.80 lampp -chmod a+rx lampp sed -e 's/88/80/g' etc/httpd.conf > etc/httpd.conf.80 mv etc/httpd.conf.80 etc/httpd.conf -sed -e 's/88/80/g' etc/extra/httpd-vhosts.conf > etc/extra/httpd-vhosts.conf.80 -mv etc/extra/httpd-vhosts.conf.80 etc/extra/httpd-vhosts.conf - sed -e 's/3308/3306/g' etc/my.cnf > etc/my.cnf.3306 mv etc/my.cnf.3306 etc/my.cnf -sed -e 's/3308/3306/g' zentao/config/my.php > zentao/config/my.php.3306 +sed -e 's/3308/3306/g' zentao/config/my.php |grep -v mysqldump > zentao/config/my.php.3306 mv zentao/config/my.php.3306 zentao/config/my.php +echo '$config->mysqldump = "/opt/lampp/bin/mysqldump";' >> zentao/config/my.php +# change directory permissions. +chmod a+rx lampp chown nobody -R var/mysql chmod 777 tmp +chmod a+rx -R zentao chmod 777 -R zentao/tmp chmod 777 -R zentao/www/data +chmod 777 zentao/module find zentao/ -name ext |xargs chmod -R 777 + +# init the shells in zentao/bin +./zentao/bin/init.sh /opt/lampp/bin/php > /dev/null 2>&1 + +# start apache, mysql. ./lampp start diff --git a/build/linux/start88 b/build/linux/start88 index 06b0b9270d..71e3ecb0bb 100755 --- a/build/linux/start88 +++ b/build/linux/start88 @@ -1,29 +1,51 @@ #!/bin/bash +# This file is used to start apache at 88 port and mysql at 3308 port. + +# check the directory, must at /opt/lampp. +pwd | grep ^/opt/lampp > /dev/null 2>&1 # check the pwd is /opt/lampp or not. +if [ $? -ne 0 ] +then + # if the pwd is not /opt/lampp, may be the /opt/lampp is a link, check /opt/lampp exists or not. + ls /opt/lampp > /dev/null 2>&1 + if [ $? -ne 0 ] + then + echo "The lampp can only run at /opt/lampp" + fi +fi + +# check the run user, must be root. if test "`id -u`" -ne 0 then echo "You need to start XAMPP as root!" exit fi +# replace ports. sed -e 's/80/88/g' lampp | sed -e 's/3306/3308/g' > lampp.88 mv lampp.88 lampp -chmod a+rx lampp sed -e 's/80/88/g' etc/httpd.conf > etc/httpd.conf.88 mv etc/httpd.conf.88 etc/httpd.conf -sed -e 's/80/88/g' etc/extra/httpd-vhosts.conf > etc/extra/httpd-vhosts.conf.88 -mv etc/extra/httpd-vhosts.conf.88 etc/extra/httpd-vhosts.conf - sed -e 's/3306/3308/g' etc/my.cnf > etc/my.cnf.3308 mv etc/my.cnf.3308 etc/my.cnf -sed -e 's/3306/3308/g' zentao/config/my.php > zentao/config/my.php.3308 +sed -e 's/3306/3308/g' zentao/config/my.php |grep -v mysqldump > zentao/config/my.php.3308 mv zentao/config/my.php.3308 zentao/config/my.php +echo '$config->mysqldump = "/opt/lampp/bin/mysqldump";' >> zentao/config/my.php +# change directory permissions. +chmod a+rx lampp chown nobody -R var/mysql chmod 777 tmp +chmod a+rx -R zentao chmod 777 -R zentao/tmp chmod 777 -R zentao/www/data +chmod 777 zentao/module find zentao/ -name ext |xargs chmod -R 777 + +# init the shells in zentao/bin +./zentao/bin/init.sh /opt/lampp/bin/php > /dev/null 2>&1 + +# start apache, mysql. ./lampp start