ogp_agent.init 694 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # Generic Init script if we can't find what kind of Linux we're on
  3. agent_dir=OGP_AGENT_DIR
  4. agent_user=OGP_USER
  5. # Start function.
  6. start() {
  7. echo "Starting OGP Agent..."
  8. cd $agent_dir
  9. su -c "screen -d -m -t ogp_agent -c ogp_screenrc -S ogp_agent ./ogp_agent_run -pidfile ogp_agent_run.pid" $agent_user &> $agent_dir/ogp_agent.svc &
  10. echo
  11. }
  12. # Stop function.
  13. stop() {
  14. echo "Stopping OGP Agent..."
  15. kill `cat $agent_dir/ogp_agent_run.pid`
  16. }
  17. restart() {
  18. stop
  19. start
  20. }
  21. case $1 in
  22. start)
  23. start
  24. ;;
  25. stop)
  26. stop
  27. ;;
  28. restart)
  29. restart
  30. ;;
  31. *)
  32. echo "Usage: ogp_agent {start|stop|restart}"
  33. exit 1
  34. ;;
  35. esac
  36. exit 0;