start.sh 817 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. php-fpm7
  3. nginx
  4. nohup redis-server /opt/redis.conf & > /dev/null &
  5. lock_file="/move.lock"
  6. source_dir="/www/"
  7. destination_dir="/app"
  8. if [ ! -e "$destination_dir" ]; then
  9. mkdir "$destination_dir"
  10. fi
  11. chmod -R 777 "$destination_dir"
  12. # 检查是否存在锁文件
  13. if [ ! -e "$lock_file" ]; then
  14. # 如果锁文件不存在,执行移动操作
  15. chmod -R 777 "$source_dir"
  16. rsync -aL "$source_dir/" "$destination_dir"
  17. chmod -R 777 "$destination_dir"
  18. # 创建锁文件
  19. touch "$lock_file"
  20. rm -rf "$source_dir";
  21. fi
  22. if [ -e "/app/public/installed.lock" ]; then
  23. # 如果锁文件存在,执行以下更新数据库操作
  24. echo "检查数据库更新...";
  25. php "$destination_dir/think" repair
  26. fi
  27. echo "php-fpm7,redis and nginx started";
  28. while true; do
  29. sleep 2
  30. done