#!/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 sed -e 's/88/80/g' etc/httpd.conf > etc/httpd.conf.80 mv etc/httpd.conf.80 etc/httpd.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 mv zentao/config/my.php.3306 zentao/config/my.php sed -e 's/3308/3306/g' phpmyadmin/config.inc.php > phpmyadmin/config.inc.php.3306 mv phpmyadmin/config.inc.php.3306 phpmyadmin/config.inc.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 if [ ! -f ./zentao/bin/backup.sh ]; then ip=`ifconfig |grep inet|head -n 1 |awk -F':' '{print $2}' |awk -F ' ' '{print $1}'` pmsRoot=http://$ip/zentao/ ./zentao/bin/init.sh /opt/lampp/bin/php $pmsRoot > /dev/null 2>&1 fi # start apache, mysql. ./lampp start