From 8a45a5152f953c5573bd18a3bd8b0785f3dea513 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Tue, 1 Aug 2017 10:19:21 +0100 Subject: Removed lots of cruft, and merged the example.conf with etc/mauveserver.conf --- utils/buffer_size.sh | 32 ------------- utils/clear_wrong_reminder.sql | 4 -- utils/get_last_test_db.sh | 3 -- utils/get_last_test_log.sh | 3 -- utils/get_live_db.sh | 3 -- utils/init_jmauve.sh | 80 -------------------------------- utils/init_mauve.sh | 83 --------------------------------- utils/packet_processing.sh | 32 ------------- utils/run_android.sh | 2 - utils/supportbot-mauve | 73 ----------------------------- utils/test-smack.rb | 101 ----------------------------------------- 11 files changed, 416 deletions(-) delete mode 100755 utils/buffer_size.sh delete mode 100644 utils/clear_wrong_reminder.sql delete mode 100755 utils/get_last_test_db.sh delete mode 100755 utils/get_last_test_log.sh delete mode 100755 utils/get_live_db.sh delete mode 100755 utils/init_jmauve.sh delete mode 100755 utils/init_mauve.sh delete mode 100755 utils/packet_processing.sh delete mode 100755 utils/run_android.sh delete mode 100755 utils/supportbot-mauve delete mode 100755 utils/test-smack.rb (limited to 'utils') diff --git a/utils/buffer_size.sh b/utils/buffer_size.sh deleted file mode 100755 index 02984b2..0000000 --- a/utils/buffer_size.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -NO_ARGS=0 -OPTERROR=65 -if [ $# -eq "$NO_ARGS" ] # Script invoked with no command-line args? -then - echo "Usage: `basename $0` File.log" - exit $OPTERROR # Exit and explain usage, if no argument(s) given. -fi -logFile=$1 - -egrep 'Buffer has [0-9]* packets left' $logFile |\ - awk 'BEGIN {print " date sz"} {print s++ " " $1 "::" $2 " " $10}' > data - -R --vanilla --no-save --slave < $PIDFILE - for i in `seq 0 1 11`;do sleep 1; echo -n '.'; done - kill -0 $(cat $PIDFILE) - if [ $? != 0 ] ; then echo -n "failed"; else echo -n "success"; fi - - # Email on start. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was started at `date`" $address - - log_end_msg $? - ;; - stop) - log_begin_msg "Stopping $DESC:" "$NAME" - if [ -f $PIDFILE ] ; then - kill `cat $PIDFILE` - rm $PIDFILE - - # Email on stop. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was stopped at `date`" $address - - else - echo Not running to stop - exit 1 - fi - log_end_msg $? - ;; - reload) - if [ -f $PIDFILE ] ; then - echo Sending restart signal to mauveserver - kill -HUP `cat $PIDFILE` - else - echo Not running to reload - fi - ;; - restart|reload|force-reload) - $0 stop - sleep 1 - $0 start - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/utils/init_mauve.sh b/utils/init_mauve.sh deleted file mode 100755 index 309562c..0000000 --- a/utils/init_mauve.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: mauveserver -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start the mauve alerting daemon at boot time -# Description: Start the mauve alerting daemon at boot time -### END INIT INFO - -PATH=/bin:/sbin:/usr/bin:/usr/local/bin -DAEMON=/usr/bin/mauveserver -DAEMON_OPTS=/etc/mauvealert/mauveserver.conf -DESC="mauvealert server" -PIDFILE=/var/run/mauveserver.pid -LOG=/var/log/mauve - -test -x $DAEMON || exit 0 - -. /lib/lsb/init-functions - -case "$1" in - start) - log_begin_msg "Starting $DESC:" "$NAME" - if [ ! -d $LOG ]; then mkdir $LOG; fi - chown mauveserver $LOG /var/lib/mauveserver - $DAEMON $DAEMON_OPTS & - echo $! > $PIDFILE - #start-stop-daemon --background --make-pidfile --pidfile $PIDFILE \ - # --start --quiet --chuid mauveserver \ - # --exec "$DAEMON" --oknodo -- $DAEMON_OPTS - sleep 3 - #kill -0 $(cat $PIDFILE) - #if [ $? != 0 ] ; then echo -n "failed"; else echo -n "success"; fi - - # Email on start. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was started at `date`" $address - - log_end_msg $? - ;; - stop) - log_begin_msg "Stopping $DESC:" "$NAME" - if [ -f $PIDFILE ] ; then - kill `cat $PIDFILE` - rm $PIDFILE - - # Email on stop. - address="yann@bytemark.co.uk" - lastLog=`/bin/ls -tr $LOG/*.log | tail -1` - logLastLines=`tail -101 $lastLog` - echo $logLastLines | mail -s "Mauve was stopped at `date`" $address - - else - echo Not running to stop - exit 1 - fi - log_end_msg $? - ;; - reload) - if [ -f $PIDFILE ] ; then - echo Sending restart signal to mauveserver - kill -HUP `cat $PIDFILE` - else - echo Not running to reload - fi - ;; - restart|reload|force-reload) - $0 stop - sleep 1 - $0 start - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/utils/packet_processing.sh b/utils/packet_processing.sh deleted file mode 100755 index d78a916..0000000 --- a/utils/packet_processing.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -NO_ARGS=0 -OPTERROR=65 -if [ $# -eq "$NO_ARGS" ] # Script invoked with no command-line args? -then - echo "Usage: `basename $0` File.log" - exit $OPTERROR # Exit and explain usage, if no argument(s) given. -fi -logFile=$1 - -egrep 'Packet processed in [\.0-9]* seconds' $logFile |\ - awk 'BEGIN {print " date sz"} {print s++ " " $1 "::" $2 " " $11}' > data - -R --vanilla --no-save --slave <" - else - t.content += "
"+attachment+"

" - end - end - t - else - nil - end - end.compact - end -end - -class String; def escape; gsub(/[^A-Za-z0-9]/) { |x| "\\#{x}" }; end end - -config = File.open("supportbot.config") { |fh| - YAML::parse(fh.read).transform } - -system("mauvesend -o supportbot -i heartbeat -r +10m -c now -s \"heartbeat not received\" -d \"Headtbeat send from supportbot-mauve code. It maybe down.\"") - -rt = RT.new(config['rt']['bin'], config['rt']['ticket_query2']) - -if 0 < rt.tickets.size - args = %w( mauvesend alert.bytemark.co.uk -o supportbot ) - args += rt.tickets.map do |ticket| - ["-i", ticket.id.to_s, - "-u", ticket.id.to_s, - "-s", ticket.subject, - "-d", ticket.content - ] - end.flatten - exec(*args) -else - args = %w( mauvesend alert.bytemark.co.uk --id supportbot -o supportbot -p -c now ) - exec(*args) -end diff --git a/utils/test-smack.rb b/utils/test-smack.rb deleted file mode 100755 index 022f9d0..0000000 --- a/utils/test-smack.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/jruby -# CLASSPATH="$CLASSPATH:/home/yann/projects/mauvealert/jars/smack.jar:/home/yann/projects/mauvealert/jars/smackx.jar -# ./test-smack - -require 'java' -require '../jars/smack.jar' -require '../jars/smackx.jar' -require 'rubygems' -require 'rainbow' -require 'pp' - -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" - -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -begin - - print "XMPP object instanciated.\n".color(:green) - xmpp = XMPPConnection.new("chat.bytemark.co.uk") - - - print "Connection done.\n".color(:green) - xmpp.connect - if true != xmpp.isConnected - print "Failed to connect".color(:red) - return -1 - end - - - print "Login.\n".color(:green) - xmpp.login(user_jid, password, "Testing_smack") - if true != xmpp.isAuthenticated() - print "Failed to authenticate\n".color(:red) - return -1 - end - if true == xmpp.isSecureConnection() - print "Connection is secure\n".color(:green) - else - print "Connection is NOT secure.\n".color(:yellow) - end - - - print "Get chat manager.\n".color(:green) - chat = xmpp.getChatManager.createChat( - "yann@chat.bytemark.co.uk", nil) - - print "Sending message to #{chat.getParticipant}.\n".color(:green) - chat.sendMessage(msg) - - - print "Joining, sending a message and leaving a room.\n".color(:green) - #muc = MultiUserChat.new(xmpp, "office@conference.chat.bytemark.co.uk") - muc = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") - muc.join("Mauve alert bot") - muc.sendMessage(msg) - sleep 1 - #muc.leave() - - - print "Adieu monde cruel!\n".color(:green) - xmpp.disconnect - - - print "all done.\n".color(:green) -rescue => ex - print "EPIC FAIL: Raised #{ex.class} because #{ex.message}\n\n".color(:red) - raise ex -end - -=begin -require 'java' -require './jars/smack.jar' -require './jars/smackx.jar' -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -xmpp = XMPPConnection.new("chat.bytemark.co.uk") -xmpp.connect -xmpp.login(user_jid, password, "mauve_test") - -jid="yann@chat.bytemark.co.uk" -chat = xmpp.getChatManager.createChat(jid, nil) -chat.sendMessage(msg) - -xmpp.getRoster().reload() -xmpp.getRoster().getPresence(jid).isAvailable() -xmpp.getRoster().getPresence(jid).getStatus() - -muc = MultiUserChat.new(xmpp, 'office@conference.chat.bytemark.co.uk/mauvealert') -muc.join("Mauve alert bot") -muc.sendMessage(msg) - -muc2 = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") -muc2.join("Mauve alert bot") -muc2.sendMessage(msg) - -=end -- cgit v1.2.1