Posts

When VNC through systemd/xinetd fails

So there has been a lot of updates to KDM and GDM as of late in the Fedora line.  This has broken my ability to use xinetd for automatic VNC starting.  The problem is that the display manager never gives me a prompt.  So I have had to fall back to manual processes. From your local box: ssh <normal options> -L 5901:127.0.0.1:5901 (on the remote box) vncpasswd screen Xvnc -geometry 1280x720 -desktop remotedesktop -NeverShared -SecurityTypes VncAuth -PasswordFile ~/.vnc/passwd :1 ^ac lxsession -d :1 ## or your favorite wm vncviewer -PreferredEncoding Tight localhost:5901

Sun Java memory fun with logstash

I am working on a distributed logstash deployment in AWS. I'm using the Elasticcache-Redis provided by AWS as the store between the syslog receiver and the elasticcache writer (aka the worker). I keep getting OOM errors on the worker like this {:timestamp=>"2013-10-22T08:18:58.592000+0000", :message=>"Failed to flush outgoing items", :outgoing_count=>34, :exception=>java.lang.OutOfMemoryError: Java heap space, :backtrace=>[], :level=>:warn} I was aware of the ability to change the heapsize allocated to the jvm, but wasn't sure how to find it.  Luckily google helped.  I took the command line I was using to run elasticsearch and compared how the 3 settings affected the defaults java -Xms512m -Xmx512m -Xss256k -XX:+PrintFlagsFinal -version > /tmp/1 java -XX:+PrintFlagsFinal -version > /tmp/2 diff /tmp/1 That helped me figure out which default settings were important. Now, I just have to figure out how to give logstash enough ...

ipcalc where have you been hiding

Somehow I've lived this long and never stumbled upon ipcalc.  It made scripting a secondary interface and route file very easy. I wanted to be able to dynamically configure /etc/sysconfig/network-scripts/route-eth1 during boot.  I was working on my own convoluted sed script to get the right values, but ipcalc was already there and simplified my work. Normally, I'd put something like: ADDRESS0=6.6.1.0 NETMASK0=255.255.255.0 GATEWAY0=6.6.1.1 But in Amazon, some of these values can vary and for puppet to be able to distribute to any of my environments across my AZs: VPC_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH0_MAC}/vpc-ipv4-cidr-block" SUBNET_CIDR_URI="http://169.254.169.254/latest/meta-data/network/interfaces/macs/${ETH1_MAC}/subnet-ipv4-cidr-block" ADDRESS0=`ipcalc -n ${VPC_CIDR_RANGE} | sed -e's/^NETWORK/ADDRESS0/'` NETMASK0=`ipcalc -m ${VPC_CIDR_RANGE} | sed -e's/^NETMASK/NETMASK0/'` GAT...

Getting tab copy and paste right with rxvt-unicode option

I  have always liked xterm, but moved to rxvt years ago for a couple of its features.  Recently I moved to urxvt256c for all my terminal needs. When I use the AWS cli tools, which output tabs as whitespace, my double click selection has started including the tabs.  Maybe it has done this for a while, I don't know exactly when it started, but it is annoying since a double click selection which grabs a tab can screw up a command line paste if there is 1 file in the directory. So you get: ssh $(i2ip thisisthe1localfile.txt i-1234567) instead of ssh $(i2ip i-1234567) thanks to bash's autocomplete. After some googling I found what I should have found originally: https://github.com/jhelwig/rxvt-unicode-ppa/blob/master/doc/rxvt.1.pod -ptab|+ptab If enabled (default), "Horizontal Tab" characters are being stored as actual wide characters in the screen buffer, which makes it possible to select and paste them. Since a horizontal tab is a cursor movement and not an ...

Bash functions to simply finding instance IPs when using AWS CLI

We have both EC2 and VPC nodes. Sometimes it is convenient to run bash commands without having to copy and paste the values from the WebUI. Here are a couple of bash functions to do that: function i2ip () {   local NAME="$1"   local IP   for IP in `ec2-describe-instances --filter instance-state-name=running --filter instance-id=${NAME:?MISSING_VALUE} | grep ^INSTANCE | awk '{ if ( $4 ~ /^ec2/ ) print $4; else print $12; }'` ; do   echo ${IP}   done } function n2ip () {   local NAME="$1"   local IP   for IP in `ec2-describe-instances --filter instance-state-name=running --filter tag:Name=${NAME:?MISSING_VALUE} | grep ^INSTANCE | awk '{ if ( $4 ~ /^ec2/ ) print $4; else print $12; }'` ; do   echo ${IP}   done } you might do something like this: rsync -av --progress logstash $(n2ip rpmbuild-node):/tmp/. where "rpmbuild-node" was the value of a tag "Name" on the instance. I decided to return all of the values so I could handle t...

YAML Syntax Highlighting in gedit

Reference URLS: http://blog.dentcat.com/2009/09/highlighting-yaml-in-gedit_02.html http://codesauce.com/posts/gedit3-yaml-syntax-highlighting/ http://superuser.com/questions/353391/custom-gedit-syntax-highlighting-for-dummies sudo yum install subversion cd /tmp && svn checkout http://masood.googlecode.com/svn/trunk/yaml-language-spec/ cd yaml-language-spec/ sudo cp yaml.lang /usr/share/gtksourceview-3.0/language-specs/ sudo chmod 644 /usr/share/gtksourceview-3.0/language-specs/yaml.lang

The importance of /var/lock/subsys

I was experimenting with shutdown scripts today when I discovered the importance of the /var/lock/subsys  directory. I didn't realize that there was code in /etc/rc that checked for the existence of a lock file before trying to stop a service.  I guess I never had need to really look at this before.  I banged my head repeated only why the K* scripts I had created weren't working.  Until I finally looked at /etc/rc and realized it was only executing K* scripts for services that had touch /var/lock/subsys/<SERVICENAME>. Duh, should have looked there first.