diff options
author | friendica <info@friendica.com> | 2014-01-18 23:49:39 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-01-18 23:49:39 -0800 |
commit | 724ad4505628d493b43b4f585512d67dc0b4ee76 (patch) | |
tree | 4fb920a79e3dff961a6301ec56ec9f40e91f6af3 /library/ajaxchat/chat/socket/server | |
parent | 3f7032e542e3c451507fc9266ab3536155c8190f (diff) | |
download | volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.tar.gz volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.tar.bz2 volse-hubzilla-724ad4505628d493b43b4f585512d67dc0b4ee76.zip |
add ajaxchat library - needs a lot of integration work to handle decentralisation (e.g. chatroom@website) and zotid w/permissions (e.g. ACL controlled chatrooms); we can also rip out a lot of stuff we don't need.
Diffstat (limited to 'library/ajaxchat/chat/socket/server')
-rw-r--r-- | library/ajaxchat/chat/socket/server | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/library/ajaxchat/chat/socket/server b/library/ajaxchat/chat/socket/server new file mode 100644 index 000000000..806b5ef74 --- /dev/null +++ b/library/ajaxchat/chat/socket/server @@ -0,0 +1,71 @@ +#!/bin/bash + +# Simple bash script to start and stop a service +# Works without access to /var/run/ or ps and pidof commands +# +# Date:: Wed, 09 Jan 2008 +# Author:: Sebastian Tschan, https://blueimp.net +# License:: GNU Affero General Public License + + +SERVICE_TITLE=Service +SERVICE_BASENAME=${0##*/} +SERVICE_DIR=${0%/$SERVICE_BASENAME} +SERVICE_COMMAND=$SERVICE_DIR/$SERVICE_BASENAME.rb +SERVICE_CONFIG=$SERVICE_DIR/$SERVICE_BASENAME.conf +SERVICE_LOG=$SERVICE_DIR/$SERVICE_BASENAME.log +SERVICE_PIDFILE=$SERVICE_DIR/$SERVICE_BASENAME.pid + + +function start +{ + if [ -f $SERVICE_PIDFILE ] + then + echo "PID file $SERVICE_PIDFILE found - $SERVICE_TITLE already running?" + else + $SERVICE_COMMAND $SERVICE_CONFIG >> $SERVICE_LOG & echo "Started $SERVICE_TITLE..." + PID=$! + echo $PID > $SERVICE_PIDFILE + fi + exit 0 +} + +function stop +{ + if [ -f $SERVICE_PIDFILE ] + then + PID=`cat $SERVICE_PIDFILE` + kill -TERM $PID + rm -f $SERVICE_PIDFILE + echo "Stopped $SERVICE_TITLE." + else + echo "PID file $SERVICE_PIDFILE not found - $SERVICE_TITLE not running?" + fi + exit 0 +} + +function main +{ + for arg in $@ + do + if [ $arg == "start" ] + then + start + elif [ $arg == "stop" ] + then + stop + else + echo "Unknown argument:" $arg + echo "Usage: $0 [start|stop]" + exit 0 + fi + done + + echo "Missing argument." + echo "Usage: $0 [start|stop]" + exit 0 +} + + +# Script execution: +main $@
\ No newline at end of file |