Archive

Archive for the ‘Braindump’ Category

MacOSX Lion Gigabit ethernet slowness

June 27th, 2012 No comments

Here, for my own reference:

kern.ipc.maxsockbuf=8388608
net.inet.tcp.recvspace=4194304
net.inet.tcp.sendspace=4194304
kern.ipc.somaxconn=512
kern.ipc.maxsockets=2048
kern.ipc.nmbclusters=2048
net.inet.tcp.rfc1323=1
net.inet.tcp.win_scale_factor=3
net.inet.tcp.sockthreshold=16
net.inet.tcp.mssdflt=1440
net.inet.tcp.msl=15000
net.inet.tcp.always_keepalive=0
net.inet.tcp.delayed_ack=0
net.inet.tcp.slowstart_flightsize=4
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.icmp.icmplim=50
Tags:

Backing up Zimbra using LVM

March 17th, 2012 1 comment

Now, since we moved to Zimbra I wanted to actually have it backed up.
Small script to do it using LVM:

#!/bin/bash
DATE=`date -u +%d%m%Y`
 
echo "`date +%k:%M:%S` Backup started."
# Stop zimbra, create a snapshot volume, start zimbra
echo -n "`date +%k:%M:%S` Stopping zimbra... "
/etc/init.d/zimbra stop 2&> /dev/null
echo " done."
echo -n "`date +%k:%M:%S` Creating snapshot volume... "
/usr/sbin/lvcreate -L 5G -s -n vol_zimbrabackup /dev/vg0/vol_zimbrarh 2> /dev/null 1> /dev/null
echo " done."
echo -n "`date +%k:%M:%S` Starting zimbra... "
/etc/init.d/zimbra start 2&> /dev/null
echo " done."
 
# Mount the snapshot, create a backup tarball, unmount snapshot, remove the volume
echo -n "`date +%k:%M:%S` Mounting snapshot... "
/bin/mount /dev/vg0/vol_zimbrabackup /zimbrabackup 2> /dev/null 1> /dev/null
echo " done."
echo -n "`date +%k:%M:%S` Packing up stuff... "
/bin/tar jcf /var/backup/zimbra-$DATE.tar.bz2 /zimbrabackup/* 2&> /dev/null
echo " done."
echo -n "`date +%k:%M:%S` Un-mounting snapshot... "
/bin/umount /zimbrabackup
echo " done."
echo -n "`date +%k:%M:%S` Removing the snapshot... "
/usr/sbin/lvremove -f /dev/vg0/vol_zimbrabackup 2> /dev/null 1> /dev/null
echo " done."
 
# Cleanup logs older than a week
echo -n "`date +%k:%M:%S` Cleaning up old stuff... "
/usr/bin/find /var/backup/zimbra*.bz2 -type f -mtime +7 | xargs rm -f 2&> /dev/null
echo " done."
echo "`date +%k:%M:%S` Backup done."
Tags:

Migrating from Scalix to Zimbra

March 17th, 2012 7 comments

So, this week I again got a feeling that Scalix is not coming back from the dead as a company. After waiting for more than a year for new versions – I gave up.

Search for a new solution ended up on choosing Zimbra Opensource Edition.

Considering that I wasn’t able to find any real guide to migration, I decided to lay down my experiences over here for my own use and for whoever might find this useful.

Read more…

Tags:

How to install Adobe Photoshop CS5 on a case-sensitive MacOS volume

January 21st, 2012 No comments

https://bitbucket.org/lokkju/adobe_case_sensitive_volumes

This is just incredible. I’m sooooo thankful to this guy. Millions of kudos.

Tags:

+1, really +1

January 6th, 2012 No comments


Oh so true.

Tags:

And in 2 smooth moves I got myself a new desktop.

November 26th, 2011 Comments off

Having been totally annoyed by constant windows quirks, being a unix admin and being used to easily tunnel SSH connections and whatnot on a mac, one day I got totally pissed off by not being able to do that easily on windows machine, so I rushed into a mac reseller demanding a mac pro… So, there it went 😉

Read more…

Tags: , ,

F6 :(

November 2nd, 2011 Comments off

myWPEdit Image

Tags:

Python script to clean up binlogs based on number

October 25th, 2011 No comments

I stumbled on a problem in MySQL that you can only rotate binlogs based on age. In certain cases it wasn’t sufficient. Scripts that I’ve found on the net (mysql doc, etc) were all in PHP/perl… So I took a bit of liberty and stole one idea from mysql’s doc comments and turned it into a piece of Python code. (uyes, ai luv python… hisssssssss).

#!/usr/bin/env python
#
# Since MySQL is unable to purge logs based on number of logs and does it only based on days
# I stole this idea from mysql.com. It was in PHP, I rewrote it in Python <3
#
#         vllazarenko@ebay.com
#
# Questions? Do mail or pass by.
#
#
 
import sys
import MySQLdb
 
""" If you want to smurf, smurf over here """
 
slaveHost="localhost"
slaveUser="root"
slavePass="rootpass"
slaveDb=""
 
masterHost="masterhost"
masterUser="root"
masterPass="rootpass"
masterDb=""
 
keepLogs = 5
 
 
""" Please don't smurf after this line, unless you're an experienced smurf """
 
try:
     connSlave = MySQLdb.connect(slaveHost,
        	                 slaveUser,
                	         slavePass,
                        	 slaveDb)
except MySQLdb.Error, e:
     print "SLAVE: Error %d: %s" % (e.args[0], e.args[1])
     sys.exit (1)
 
try:
	connMaster = MySQLdb.connect(masterHost,
        	                     masterUser,
                	             masterPass,
                        	     masterDb)
except MySQLdb.Error, e:
     print "MASTER: Error %d: %s" % (e.args[0], e.args[1])
     sys.exit (1)
 
cursSlave = connSlave.cursor(MySQLdb.cursors.DictCursor)
cursMaster = connMaster.cursor(MySQLdb.cursors.DictCursor)
 
cursSlave.execute("SHOW SLAVE STATUS")
row = cursSlave.fetchone()
 
if row["Slave_IO_Running"] != "Yes":
	print "Alert. Slave IO not running."
if row["Slave_SQL_Running"] != "Yes":
	print "Alert. Slave SQL not running." 
if row["Last_Error"] != "":
	print "Alert. Error on slave: %s" % row["Last_Error"]
 
masterLog = row["Master_Log_File"]
print "Current Master file on which Slave is acting: %s" % masterLog
 
cursMaster.execute("SHOW MASTER LOGS")
rows = cursMaster.fetchall()
 
if cursMaster.rowcount == 0:
	print "No master logs found."
	sys.exit(1)
 
lognames = list()
 
for row in rows:
	lognames.append(row["Log_name"])
 
marker = lognames.index(masterLog)
delMarker = marker - keepLogs;
 
if delMarker < 2:
	print "Not purging below 2 logs."
	sys.exit(1)
 
print "Going to purge logs up to %s." % lognames[delMarker]
 
delQuery = "PURGE MASTER LOGS TO '%s'" % lognames[delMarker]
# cursMaster.execute(delQuery)
 
print "Master binlogs were purged. The oldest log now available on the master is %s." % lognames[delMarker]
 
cursSlave.close()
connSlave.close()
cursMaster.close()
connMaster.close()
Tags:

Just me…

October 17th, 2011 No comments

360903_460s_v1

Tags:

Music…

October 17th, 2011 No comments

Tags: