You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
337 B

2 years ago
  1. #!/bin/bash
  2. #
  3. # 1. 监听app.out,如果app.out退出,则重启app.out
  4. #
  5. # 1. 监听app.out,如果app.out退出,则重启app.out
  6. while true; do
  7. ps -ef | grep app.out | grep -v grep
  8. if [ $? -ne 0 ]; then
  9. echo "app.out is not running, restart it"
  10. cd /app
  11. ./app.sh &
  12. sleep 3
  13. fi
  14. sleep 1
  15. done