Skip to content

Instantly share code, notes, and snippets.

View RaviTezu's full-sized avatar
🎧
Wired In

RaviTeja Pothana RaviTezu

🎧
Wired In
View GitHub Profile
@RaviTezu
RaviTezu / sentry
Last active August 29, 2015 14:14 — forked from thomas-p-wilson/sentry
#!/bin/bash
# /etc/init.d/sentry
# A debian-compatible sentry startup script
#
### BEGIN INIT INFO
# Provides: sentry
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@RaviTezu
RaviTezu / README.md
Last active August 29, 2015 14:14 — forked from jalaziz/README.md

Setup

  1. Create a new user on the system:

    sudo adduser --system --group --shell /bin/bash --home /opt/sentry sentry
  2. Create the virualenv and install the required packages:

// kills long running ops in MongoDB (taking seconds as an arg to define "long")
// attempts to be a bit safer than killing all by excluding replication related operations
// and only targeting queries as opposed to commands etc.
killLongRunningOps = function(maxSecsRunning) {
currOp = db.currentOp();
for (oper in currOp.inprog) {
op = currOp.inprog[oper-0];
if (op.secs_running > maxSecsRunning && op.op == "query" && !op.ns.startsWith("local")) {
print("Killing opId: " + op.opid