Wildfly CLI on OpenShift

SSH into server using ‘rhc ssh appname’, then:

jboss-cli.sh -c --controller=$OPENSHIFT_WILDFLY_IP:$OPENSHIFT_WILDFLY_MANAGEMENT_HTTP_PORT

Then you can cd to the service that you want to inspect, eg:

cd /subsystem=messaging/hornetq-server=default/jms-queue=exampleQueue

and from there, ls will list all the properties available.

More info here and here.

Installing rtl-sdr and dump1090 on a Raspberry Pi to receive ADS-B signals

I’ve gone through these steps a couple of times when I’ve set up a new SD card, and had to go to various places to work out all the steps, so in case this is useful for someone else, here’s the steps (assuming installing on Rasbian):

Making and installing rtl-sdr from source

Instructions: http://sdr.osmocom.org/trac/wiki/rtl-sdr

Pre-req steps, if you don’t already have the following:

sudo apt-get install cmake

#usb driver for the rtl dongle
sudo apt-get install libusb-1.0

Get the source:

git clone git://git.osmocom.org/rtl-sdr.git

Build:

cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

If you get permissions errors like this when using any of the rtl_* commands:

Using device 0: Terratec T Stick PLUS
usb_open error -3
Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules
Failed to open rtlsdr device #0.

Then you should be able to add a line to

/etc/udev/rules.d/rtl-sdr.rules

 to set up correct permissions for your specific card, which you can find by running lsusb, eg for mine:

Bus 001 Device 004: ID 0ccd:00d7 TerraTec Electronic GmbH

From this I believe you take the id value and insert it into a new line in rtl-sdr.rules like:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666"

and then restart udev:

sudo service udev restart

… reboot and that should be fixed.  Or you can still run the apps with sudo.

To test, try starting up the rtl_tcp server:

sudo rtl_tcp -a your_ip

and you might see a message about the device already in use by another kernel module:

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Using device 0: Terratec T Stick PLUS
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
usb_claim_interface error -6
Failed to open rtlsdr device #0.

This is saying dvb_usb_rtl28xxu is already using the device. From instructions here, you can temporarily unload this module:

sudo rmmod dvb_usb_rtl28xxu

or permantly remove it with a blacklist entry in /etc/modprobe.d – add a new file here named something like rtl-sdr.conf, add add one line with the name of the above driver:

blacklist dvb_usb_rtl28xxu

Reboot and now you should be good to go with the rtl_* commands.

 

Making and installing dump1090:

From https://github.com/MalcolmRobb/dump1090

git clone https://github.com/MalcolmRobb/dump1090.git
cd dump1090
make

Run in interactive mode:

./dump1090 --interactive

or net mode to enable the webserver (point a browser at you Pi’s IP address and port 8080):

./dump1090 --net

Recovering MondoDB from an unclean shutdown

If MongoDB is refusing to start up and you see this message:

**************
 old lock file: \data\db\mongod.lock.  probably means unclean shutdown,
 but there are no journal files to recover.
 this is likely human error or filesystem corruption.
 found 1 dbs.
 see: http://dochub.mongodb.org/core/repair for more information
 *************

… see the instructions pointed to by the suggested URL.

Try starting up with the –repair option. When it completes, restart the server process as normal.

If you have the ‘probably means unclean shutdown’ message, remove the mongod.lock file by hand and then restart with –repair

SSLProtocolException in SE7 & SE8: “handshake alert: unrecognized_name”

Caused by: com.sun.jersey.api.client.ClientHandlerException: 
javax.net.ssl.SSLProtocolException: handshake alert:  
unrecognized_name at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle (URLConnectionClientHandler.java:151) 
at com.sun.jersey.api.client.Client.handle(Client.java:648) 
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:680) 
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) 
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:5 68) 

This exception is from an SSL check in SE7 and above that checks that your SSL certificate matches your domain name. For development, if you’re using a self-signed SSL certificate for testing which does not match your domain name, you can turn off the check and ignore the error with:

-Djsse.enableSNIExtension=false