install.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/sh
  2. #<!--Create By Junior 2020/11/25 -->
  3. service='/etc/systemd/system/junior-server.service'
  4. echo '[Unit]' > $service
  5. echo 'Description=SpringBoot Project junior-server Application' >> $service
  6. echo 'After=network.target syslog.target' >> $service
  7. echo '' >> $service
  8. echo '[Service]' >> $service
  9. echo 'Type=forking' >> $service
  10. echo 'WorkingDirectory=/opt/junior-server' >> $service
  11. echo 'ExecStart=/opt/junior-server/start.sh sysd' >> $service
  12. echo 'ExecStop=/opt/junior-server/stop.sh sysd' >> $service
  13. echo 'Restart=always' >> $service
  14. echo '' >> $service
  15. echo '[Install]' >> $service
  16. echo 'WantedBy=multi-user.target' >> $service
  17. systemctl enable junior-server.service
  18. #启动脚本名称
  19. file='start.sh'
  20. echo '#!/bin/bash' > $file
  21. # 启动入口类,该脚本文件用于别的项目时要改这里
  22. echo 'MAIN_CLASS=com.warewms.WareWmsApplication' >> $file
  23. echo 'APP_BASE_PATH=$(cd `dirname $0`; pwd)' >> $file
  24. echo 'CP=${APP_BASE_PATH}/conf:${APP_BASE_PATH}/lib/*' >> $file
  25. echo 'java -Xverify:none ${JAVA_OPTS} -cp ${CP} ${MAIN_CLASS} > logs/console.log 2>&1 &' >> $file
  26. #停止脚本名称
  27. file='stop.sh'
  28. echo '#!/bin/bash' > $file
  29. # 启动入口类,该脚本文件用于别的项目时要改这里
  30. echo 'MAIN_CLASS=com.warewms.WareWmsApplication' >> $file
  31. echo 'kill `pgrep -f ${MAIN_CLASS}` 2>/dev/null' >> $file
  32. chmod +x *.sh
  33. mkdir logs