daemon.sh 834 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #! /bin/sh
  2. # chkconfig: 2345 85 15
  3. ### BEGIN INIT INFO
  4. # chkconfig: 345 80 20
  5. # description: xwbphotovote is the main CGI of xwbphotovote.com
  6. # processname: xwbphotovote
  7. # pidfile: /dev/shm/xwbphotovote.pid
  8. ### END INIT INFO
  9. start(){
  10. cd /home/wwwcgi/swyzxwb_photovote/
  11. /home/wwwcgi/swyzxwb_photovote/start
  12. }
  13. stop(){
  14. cd /home/wwwcgi/swyzxwb_photovote/
  15. /home/wwwcgi/swyzxwb_photovote/stop
  16. }
  17. restart(){
  18. cd /home/wwwcgi/swyzxwb_photovote/
  19. /home/wwwcgi/swyzxwb_photovote/restart
  20. }
  21. redeploy(){
  22. cd /home/wwwcgi/swyzxwb_photovote/
  23. ./stop
  24. echo -e "Pulling Code From Git............[\033[40;32mOK\033[0m]"
  25. git reset --hard origin/master
  26. git clean -f
  27. git pull
  28. git checkout master
  29. ./start
  30. }
  31. case "$1" in
  32. start)
  33. #start
  34. start
  35. ;;
  36. stop)
  37. stop
  38. ;;
  39. restart)
  40. restart
  41. ;;
  42. redeploy)
  43. redeploy
  44. ;;
  45. esac
  46. exit 0