Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Restructure things a little. Put rejected.py and all start/start/rest…

…art scripts in bin. Add an init script
  • Loading branch information...
commit d7e5e599be9f2eb73149a4869cc35be8d064f2c7 1 parent 6529500
Gavin M. Roy authored
View
2  .gitignore
@@ -1,4 +1,6 @@
.DS_Store
+.bash_history
+.ssh
logs/*.txt
*.pyc
*/*.pyc
View
22 bin/opslog.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python2.6
+"""
+Send an opslog notification for the current user and server that queue consumers were restarted.
+
+__author__ = "Gavin M. Roy"
+__email__ = "gmr@myyearbook.com"
+__since__ = "2011-04-04"
+"""
+from myyearbook import pgsql
+from os import getlogin
+from socket import gethostname
+from sys import argv
+
+if len(argv) > 1:
+ notes = argv[1]
+else:
+ notes = 'Restarted rejected consumers'
+
+connection = pgsql.connect("ops02", 5432, "production", "www")
+cursor = pgsql.get_cursor(connection)
+sql = "INSERT INTO operations.log_entries (entry_type, entry_time, entry_location, author, server, notes) VALUES ('Queue Consumer', now(), 'Production', '%s', '%s', '%s')" % (getlogin(), gethostname().split('.')[0], notes)
+cursor.execute(sql)
View
7 rejected.py → bin/rejected.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.6
"""
Rejected AMQP Consumer Framework
@@ -20,10 +20,12 @@
__date__ = "2009-09-10"
__version__ = 0.2
+import sys
+sys.path.insert(0, '/opt/rejected')
+
import amqplib.client_0_8 as amqp
import exceptions
import logging
-import sys
import optparse
import os
import signal
@@ -33,6 +35,7 @@
import yaml
import zlib
+
# Number of seconds to sleep between polls
mcp_poll_delay = 10
is_quitting = False
View
4 bin/restart-email.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+ps aux |grep '[e]mail_spooler' | awk '{print $2}' | sudo xargs kill
+/opt/rejected/bin/opslog.py 'Restart email_spooler rejected consumers'
+/opt/rejected/bin/start-email.sh
View
4 bin/restart-irsupload.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+ps aux |grep '[i]rsupload/etc' | awk '{print $2}' | sudo xargs kill
+/opt/rejected/bin/opslog.py 'Restarted irsupload rejected consumers'
+/opt/rejected/bin/start-irsupload.sh
View
4 bin/restart-memoryhole.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+ps aux |grep '[m]emoryhole/etc' | awk '{print $2}' | sudo xargs kill
+/opt/rejected/bin/opslog.py 'Restarted memoryhole rejected consumers'
+/opt/rejected/bin/start-memoryhole.sh
View
6 bin/restart.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+for f in /opt/rejected/bin/restart-*sh
+do
+ exec $f
+done
+/opt/rejected/bin/setaffinity.sh
View
0  setaffinity.sh → bin/setaffinity.sh
File renamed without changes
View
42 bin/start-email.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/aol.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/aol.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/aol.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/aol.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/aol.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/gmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/gmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/gmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/gmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/gmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/hotmail.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/other.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/other.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/other.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/other.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/other.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/email_spooler/etc/yahoo.yaml -d"
View
2  bin/start-irsupload.sh
@@ -0,0 +1,2 @@
+#/bin/bash
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/irsupload/etc/production-debug.yaml -d"
View
2  bin/start-memoryhole.sh
@@ -0,0 +1,2 @@
+#/bin/bash
+su rejected -c "/opt/rejected/bin/rejected.py -c /opt/rejected/memoryhole/etc/sendgrid.yaml -d"
View
6 bin/start.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+for f in /opt/rejected/bin/start-*sh
+do
+ exec $f
+done
+/opt/rejected/bin/setaffinity.sh
View
2  bin/stop.sh
@@ -0,0 +1,2 @@
+#!/bin/bash
+ps aux | grep '[r]ejected.py' | awk '{print $2}' | sudo xargs kill
View
67 init.d/rejected
@@ -0,0 +1,67 @@
+#!/bin/bash
+# chkconfig: 2345 99 60
+# description: rejected consumers
+# processname: rejected
+
+# Source function library.
+. /etc/init.d/functions
+
+# Installation dir
+rejected_DIR="/opt/rejected"
+
+prog="rejected"
+
+start() {
+ if [ ${EUID} -ne 0 ]; then
+ echo -n $"you must be root"
+ failure $"you must be root"
+ echo
+ return 1
+ fi
+
+ echo -n $"Starting ${prog}: "
+
+ /opt/rejected/bin/start.sh
+ return 1
+}
+
+stop() {
+ if [ ${EUID} -ne 0 ]; then
+ echo -n $"you must be root"
+ failure $"you must be root"
+ echo
+ return 1
+ fi
+
+ echo -n $"Stopping ${prog}: "
+
+ /opt/rejected/bin/stop.sh
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f ${rejected_PID_FILE}
+ echo
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ RETVAL=2
+ ;;
+esac
+
+exit $RETVAL
+
View
1  logs/README
@@ -1 +0,0 @@
-Log Output Dir
Please sign in to comment.
Something went wrong with that request. Please try again.