Files
EasySoft-ZenTaoPMS/build/linux/start
2013-01-27 07:51:45 +00:00

51 lines
1.3 KiB
Bash

#!/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
# 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