Zcentric

Blog

Posts

Simple script to selectively remove emails from postfix’s queue

@Mike Zupan · Jun 20, 2012 · 1 min read

Tweet If you send out a lot of emails, the queue in postfix might be full of junk emails from people putting like bla@example.net as their email address. Now there could be other valid emails in there that you don’t want to remove due to their mail server down and postfix keeps trying for a set amount of time to …

Read More →

Nagios check for monit

@Mike Zupan · Jun 11, 2012 · 1 min read

Tweet Here is a simple nagios check I just created to check the monitor status for monit. The background is as simple as this.. If you have a service that is flapping and monit is set to timeout after a number of failed attempts to start the service, it will un-monitor the service. Without m/monit running, you might …

Read More →

Mapping /proc/meminfo to output of free command

@Mike Zupan · May 29, 2012 · 2 min read

Tweet So an example output of free is total used free shared buffers cached Mem: <span style="color: #039b3d">12333980</span> 12151544 182436 0 <span style="color: #06e572">233128</span> <span style="color: #5656ff">11197680</span> -/+ buffers/cache: 720820 11613160 Swap: <span …

Read More →

Varnish ACL with X-Forwarded-For Header

@Mike Zupan · Mar 16, 2012 · 2 min read

Tweet So I did a setup like this once nginx -> varnish -> backend apaches I did the nginx in front of varnish to handle SSL termination since varnish doesn’t do SSL. So the issue is you can do this for subnet checking in your varnish config acl vpn { "192.168.0.0"/16; } sub vcl_recv { if (client.ip ~ vpn) …

Read More →

Postfix ignore catchall relayhost

@Mike Zupan · Oct 13, 2011 · 1 min read

Tweet Postfix has an option where you can setup a relayhost to send all mail to another mail server. It looks something like relayhost = [mail.domain.com]:25 So that will send all mail being sent out from the server to mail.domain.com on port 25. So what happens if you want to send mail that is sent to company.com out …

Read More →

ps aux with line wrap

@Mike Zupan · Aug 22, 2011 · 1 min read

Tweet File this under you learn something new every day. Ever do a ps aux only to get something like this to happen? xymon 26931 0.0 0.0 38944 1396 ? S 05:44 0:00 sh -c vmstat 300 2 1>/usr/lib64/xymon/client/tmp/hob So the output of ps aux gets cut off when it hits the end of your terminal. And you have to expand …

Read More →

Fabric Shell

@Mike Zupan · Jun 27, 2011 · 1 min read

Tweet I recently wrote a quick little fabric function to create a fabric shell. This works with a stock fabric install, you just might have to change where you import it from. It is at my Github page below. https://github.com/mzupan/fabric_shell If you place shell.py in the same directory as fabfile.py you can use it …

Read More →

Fun with Django ManyToMany Fields

@Mike Zupan · Jun 21, 2011 · 1 min read

Tweet This is just another reason I find Django so easy. For example.. Say you are making a monitoring application. Now you have a bunch of servers and you have certain groups of servers. A server can belong in more then one group also. So that is pretty easy and all with Django. Now in your template you have a few …

Read More →

Crontab with a random sleep

@Mike Zupan · Jun 3, 2011 · 1 min read

Tweet Recently ran into this problem. We had a crontab entry that looked something like this 0 0 * * * /usr/bin/sleep $((RANDOM\%90)); cmdHere What that attempted was to run a command a random amount of seconds once midnight hit. Now running the command on console causes it to error out $  /usr/bin/sleep …

Read More →

Atomic Symlink Changes

@Mike Zupan · Apr 1, 2011 · 2 min read

Tweet A common deploy strategy for a lot of web sites is as follows v1.0.10 v1.0.11 v1.1.0 current -> v1.1.0 So in this directory we have three directories and one symlink. The directories contain our web application and are tagged with the source control version they were tagged with by the developers. Now its a …

Read More →