Tuesday, July 29, 2014

Disable NGINX autostart in Ubuntu 14.04

$ update-rc.d -f nginx remove

Monday, February 10, 2014

My ssh protocol handler for Firefox and under Linux

#!/bin/bash
address=`echo $1 | sed -e "s/ssh:\/\///" | sed -e "s|:....||"`
str=$1
n=4
port=`echo ${str:${#str} - $n}`
gnome-terminal -e "ssh ${address} -p ${port}"



Put this in a file and set it as executable. I put mine in ~/.bin/sshhandler
(chmod +x ~/.bin/sshhandler)
in firefox go to about:config
add new boolean value called
network.protocol-handler.expose.ssh

Set it to false.

In Firefox navigate to an ssh:// url and select the script as the application to handle them.

This should handle urls formatted in the following manner:

ssh://user@hostname:port


Friday, February 07, 2014

Friday, January 31, 2014

Online expanding of a VMWare linux server LVM Volume

Add the hard drive to the running VM.

dmesg (figure out what the device name is for the new device like /dev/sdf)
parted /dev/sdf

mklabel msdos (inside parted)
quit (inside parted)

pvcreate /dev/sdf
vgextend VolGroup00 /dev/sdf
lvextend /dev/mapper/VolGroup00-LogVol00 /dev/sdf
resize2fs /dev/mapper/VolGroup00-LogVol00 

Thursday, January 30, 2014

Compress and transfer in one step

This command uses tar to compress a directory and store it into a file located on a remote system. Handy.
$ tar vzcf - /path/to/data | ssh user@remotesvr `cat - > /backups/data.tgz`

Pure command line if then without the if or then

The && and || can be used to control command flow like if then...
$ /use/bin/somecmd && echo "it worked!" || echo "epic fail!"

Process list filtering with grep

Adding the square brackets prevents the grep command from showing up in the process list.

$ ps -ef | grep proces[s]

Icinga log parsing perl command

The perl command changes unix time to human readable time in the output... Very useful for searching the check log archives.

more /usr/local/icinga/var/archives/* | perl -p -e 's/^\[(\d+)\]/"[". localtime($1) . "]"/e' | grep <what you're looking for>