Yearly Archives: 2011




When writing reports I’ve often come across the need to find the unix timestamp beginning and end of a day. Here is a Python snippet that does just that. yesterday = datetime.datetime.now() - datetime.timedelta(days = 1) yesterday_beginning = datetime.datetime(yesterday.year, yesterday.month, yesterday.day,0,0,0,0) yesterday_beginning_time = int(time.mktime(yesterday_beginning.timetuple())) yesterday_end = datetime.datetime(yesterday.year, yesterday.month, yesterday.day,23,59,59,999) yesterday_end_time […]

Finding yesterday’s beginning and ending unix timestamp



Here is a simple script I’ve found to be quite helpful for monitoring the status of background index builds across shards on a system: var currentOps = db.currentOp(); if(!currentOps.inprog || currentOps.inprog.length < 1) { print("No operations in progress"); } else { for(o in currentOps.inprog) { var op = currentOps.inprog[o]; if(op.msg […]

MongoDB script to check the status of background index builds