start.sh 588 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  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. chmod -R 777 "$source_dir"
  9. if [ ! -e "$destination_dir" ]; then
  10. mkdir "$destination_dir"
  11. fi
  12. chmod -R 777 "$destination_dir"
  13. # 检查是否存在锁文件
  14. if [ ! -e "$lock_file" ]; then
  15. # 如果锁文件不存在,执行移动操作
  16. rsync -aL "$source_dir/" "$destination_dir"
  17. # 创建锁文件
  18. touch "$lock_file"
  19. rm -rf "$source_dir";
  20. fi
  21. echo "php-fpm7,redis and nginx started";
  22. while true; do
  23. sleep 2
  24. done