For the past couple of months I've been working on an automated internet radio system based on Liquidsoap, with scripts written (so far) in bash.
Here is the github repo:
https://github.com/jimsheldon/radiate
Documentation is almost non-existent at this point, the system is currently very rigid and probably not much good to anyone else as-is. My hope is to get it to the point where someone could easily grab the code and deploy their own station in a few simple steps.
The Bit Brewer
Reflections on free culture, software, and occasionally beer...
Tuesday, March 20, 2012
Monday, October 17, 2011
Bash substring exclusive replacement
This is a neat little trick I figured out today. I needed to remove all characters from a variable that were not digits or spaces. I've done a lot of variable manipulation in bash, but nothing with more than one condition.
It turns out that you can negate with the ^ character, combined with the | "or" character to get this:
It turns out that you can negate with the ^ character, combined with the | "or" character to get this:
$ MYVAR="4322, #32" $ echo ${MYVAR//[^[:digit:]|[:space:]]/} 4322 32
Thursday, October 6, 2011
SSH chained port forwarding
I might be late to the party on this, but I just realized that you can chain forwarded ports in ssh!
For example:
For example:
ssh -L port1:<ip address>:I'll admit, I'm guilty of opening multiple ssh sessions to forward each port that I needed... Never again!hostport1 -L port2:<ip address>: hostport2 somewhere.com
Tuesday, October 4, 2011
Convert Xen XP domU to KVM
Recently I needed to take a windows XP VM under Xen from my workstation and move it to my laptop running KVM.
The Xen VM uses an LVM block device. I was able to use qemu-img to convert the raw LVM block filesystem into the compressed qcow2 format:
Back over on my laptop, importing the qcow2 image was a breeze. I simply launched "Virtual Machine Manager" and selected "importing existing disk image", and pointed to the image.
XP booted fine, but I did have to re-activate windows due to hardware "changes" that windows saw.
The qcow2 format is nice since it's compressed, but there is definitely a performance hit. I plan on experimenting with moving the VM to an external eSATA drive, on a raw block device, and see how much it helps performance.
The Xen VM uses an LVM block device. I was able to use qemu-img to convert the raw LVM block filesystem into the compressed qcow2 format:
qemu-img convert -c -f raw -O qcow2 /dev/vgxen/xp xp.qcow2This took over an hour, since the filesystem is 100GB.
Back over on my laptop, importing the qcow2 image was a breeze. I simply launched "Virtual Machine Manager" and selected "importing existing disk image", and pointed to the image.
XP booted fine, but I did have to re-activate windows due to hardware "changes" that windows saw.
The qcow2 format is nice since it's compressed, but there is definitely a performance hit. I plan on experimenting with moving the VM to an external eSATA drive, on a raw block device, and see how much it helps performance.
Subscribe to:
Posts (Atom)