test.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. # Author: yeho <lj2007331 AT gmail.com>
  3. # Blog: http://blog.linuxeye.com
  4. TEST()
  5. {
  6. cd $oneinstack_dir/src
  7. . ../functions/download.sh
  8. . ../options.conf
  9. public_IP=`../functions/get_public_ip.py`
  10. if [ "`../functions/get_ip_area.py $public_IP`" == '\u4e2d\u56fd' ];then
  11. FLAG_IP=CN
  12. fi
  13. echo $public_IP $FLAG_IP
  14. if [ "$FLAG_IP"x == "CN"x ];then
  15. src_url=http://mirrors.linuxeye.com/lnmp/src/tz.zip && Download_src
  16. unzip -q tz.zip -d $home_dir/default
  17. /bin/cp $oneinstack_dir/conf/index_cn.html $home_dir/default/index.html
  18. else
  19. src_url=http://mirrors.linuxeye.com/lnmp/src/tz_e.zip && Download_src
  20. unzip -q tz_e.zip -d $home_dir/default;/bin/mv $home_dir/default/{tz_e.php,proberv.php}
  21. sed -i 's@https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js@http://lib.sinaapp.com/js/jquery/1.7/jquery.min.js@' $home_dir/default/proberv.php
  22. /bin/cp $oneinstack_dir/conf/index.html $home_dir/default
  23. fi
  24. src_url=https://gist.githubusercontent.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php && Download_src
  25. echo '<?php phpinfo() ?>' > $home_dir/default/phpinfo.php
  26. [ "$PHP_cache" == '1' ] && /bin/cp ocp.php $home_dir/default && sed -i 's@<a href="/xcache" target="_blank" class="links">xcache</a>@<a href="/ocp.php" target="_blank" class="links">Opcache</a>@' $home_dir/default/index.html
  27. [ "$PHP_cache" == '3' ] && sed -i 's@<a href="/xcache" target="_blank" class="links">xcache</a>@<a href="/apc.php" target="_blank" class="links">APC</a>@' $home_dir/default/index.html
  28. [ "$PHP_cache" == '4' ] && /bin/cp eaccelerator-*/control.php $home_dir/default && sed -i 's@<a href="/xcache" target="_blank" class="links">xcache</a>@<a href="/control.php" target="_blank" class="links">eAccelerator</a>@' $home_dir/default/index.html
  29. chown -R ${run_user}.$run_user $home_dir/default
  30. [ -e "$db_install_dir" -a -z "`ps -ef | grep -v grep | grep mysql`" ] && /etc/init.d/mysqld restart
  31. [ -e "$apache_install_dir" -a -z "`ps -ef | grep -v grep | grep apache`" ] && /etc/init.d/httpd restart
  32. cd ..
  33. }