Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

server scripts

  • Loading branch information...
commit 6d02187012507e1a99eccee839e3c2fdeed98c07 1 parent 62521f1
@ciudilo ciudilo authored
View
11 scripts/envcreate.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Run this a normal user in order go get all files setup needed for daemon
+
+cd /opt/shoutfb
+
+touch shoutd
+chmod a=rx shoutd
+
+touch shoutd.log
+chmod o+rw
+
View
85 scripts/shoutd
@@ -0,0 +1,85 @@
+#!/bin/sh
+#
+# shoutfb init file for starting up the shoutfb daemon
+#
+# chkconfig: - 20 80
+# description: Starts and stops the shoutfb daemon.
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+name="shoutfb"
+user="nginx"
+exec="/opt/shoutfb/start.sh"
+pidfile="/tmp/shoutd.pid"
+
+lockfile=/var/lock/subsys/shoutfb
+
+start() {
+ [ -x $exec ] || exit 5
+ echo -n $"Starting $name: "
+ daemon --user $user "$exec"
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ echo -n $"Stopping $name: "
+ killproc -p $pidfile $name
+ retval=$?
+ echo
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ false
+}
+
+rh_status() {
+ status -p $pidfile $name
+}
+
+rh_status_q() {
+ rh_status >/dev/null 2>&1
+}
+
+
+case "$1" in
+ start)
+ rh_status_q && exit 0
+ $1
+ ;;
+ stop)
+ rh_status_q || exit 0
+ $1
+ ;;
+ restart)
+ $1
+ ;;
+ reload)
+ rh_status_q || exit 7
+ $1
+ ;;
+ force-reload)
+ force_reload
+ ;;
+ status)
+ rh_status
+ ;;
+ condrestart|try-restart)
+ rh_status_q || exit 0
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+ exit 2
+esac
+exit $?
View
10 scripts/start.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+cd /opt/shoutfb
+
+. /opt/shoutfb/shoutfb/bin/activate
+
+python test.fcgi &> shoutd.log &
+
+echo $! > /tmp/shoutd.pid
+
View
6 server.fcgi
@@ -0,0 +1,6 @@
+from flup.server.fcgi import WSGIServer
+from server import create_app
+
+if __name__ == '__main__':
+ application = create_app()
+ WSGIServer(application, bindAddress='/tmp/shoutfb-fcgi.sock').run()
View
7 server.py
@@ -60,6 +60,10 @@ def index():
return render_template('index.html', vparams=params)
+@app.route('/status/', methods=['GET'])
+def getstaus():
+ return 'We are on!'
+
def main():
# Random words!
app.words = open("/usr/share/dict/words").readlines()
@@ -77,5 +81,8 @@ def main():
persist()
app.run(debug=True, host='0.0.0.0')
+def create_app():
+ return app
+
if __name__ == "__main__":
main();
Please sign in to comment.
Something went wrong with that request. Please try again.