#! /bin/sh
# chkconfig: 2345 85 15 
### BEGIN INIT INFO
# chkconfig: 345 80 20
# description: xwbphotovote is the main CGI of xwbphotovote.com
# processname: xwbphotovote
# pidfile: /dev/shm/xwbphotovote.pid
### END INIT INFO
start(){
	cd /home/wwwcgi/swyzxwb_photovote/
  /home/wwwcgi/swyzxwb_photovote/start
}
stop(){
	cd /home/wwwcgi/swyzxwb_photovote/
	/home/wwwcgi/swyzxwb_photovote/stop
}
restart(){
	cd /home/wwwcgi/swyzxwb_photovote/
	/home/wwwcgi/swyzxwb_photovote/restart
}
redeploy(){
  cd /home/wwwcgi/swyzxwb_photovote/
  ./stop
  echo -e "Pulling Code From Git............[\033[40;32mOK\033[0m]"
  git reset --hard origin/master
  git clean -f
  git pull
  git checkout master
  ./start
}
case "$1" in
  start)
  #start
  start
  ;;
  stop)
  stop
  ;;
  restart)
  restart
  ;;
  redeploy)
  redeploy
  ;;
esac
exit 0 
