install.sh 885 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. #Read parameters
  3. echo "Please input the configuration file name"
  4. read conf
  5. echo "Please input the program"
  6. read program
  7. echo "Please input the process_name"
  8. read process_name
  9. echo "Please input the user"
  10. read user
  11. echo "Please input the command"
  12. read command
  13. echo "Please input the directory"
  14. read directory
  15. #Copy the configuration file in the supervisor.d folder
  16. served="/etc/supervisord.d"
  17. if [ -f "$served/$conf" ]
  18. then
  19. echo "The service has already existed"
  20. exit 1
  21. else
  22. # The first position is server.conf File installation directory
  23. cp server.conf $served/$conf
  24. fi
  25. #替换变量
  26. sed -i "s#PROGRAM#$program#g" $served/$conf
  27. sed -i "s#PROCESS_NAME#$process_name#g" $served/$conf
  28. sed -i "s#USER#$user#g" $served/$conf
  29. sed -i "s#DIRECTORY#$directory#g" $served/$conf
  30. sed -i "s#COMMAND#$command#g" $served/$conf
  31. #重读supervisor配置文件
  32. supervisorctl update