start.sh 624 B

1234567891011121314151617181920212223242526272829303132333435
  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. 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. echo "php-fpm7,redis and nginx started";
  23. while true; do
  24. sleep 2
  25. done