zry 8 lat temu
rodzic
commit
a15482a6c8
4 zmienionych plików z 75 dodań i 0 usunięć
  1. 46 0
      daemon.sh
  2. 3 0
      restart
  3. 13 0
      start
  4. 13 0
      stop

+ 46 - 0
daemon.sh

@@ -0,0 +1,46 @@
+#! /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 

+ 3 - 0
restart

@@ -0,0 +1,3 @@
+#! /bin/sh
+./stop
+./start

+ 13 - 0
start

@@ -0,0 +1,13 @@
+#!/bin/sh
+pidfile=/dev/shm/xwbphotovote.pid
+host=0.0.0.0
+port=8701
+basedir=/home/wwwcgi/swyzxwb_photovote/
+if [ ! -f "$pidfile" ]; then
+	cd $basedir
+	python2.7 manage.py runfcgi host=$host port=$port pidfile=$pidfile outlog=${basedir}out.log errlog=${basedir}err.log
+	echo -e "Starting swyzxwb_photovote CGI..............[\033[40;32mOK\033[0m]"
+else
+	echo -e "Starting swyzxwb_photovote CGI..............[\033[40;31mFAILURE\033[0m]"
+	echo "CGI Maybe Already Running... Please Try to Use Restart Operation."
+fi

+ 13 - 0
stop

@@ -0,0 +1,13 @@
+#!/bin/sh
+pidfile=/dev/shm/xwbphotovote.pid
+if [ ! -f "$pidfile" ]; then 
+	echo -e "Stopping swyzxwb_photovote CGI..............[\033[40;31mFAILURE\033[0m]"
+	echo "CGI Maybe Not Running."
+else
+	read fpid < $pidfile
+	kill $fpid
+	echo -e "Stopping swyzxwb_photovote CGI..............[\033[40;32mOK\033[0m]"
+	rm -f $pidfile
+fi
+	
+