{"id":1942,"date":"2017-12-11T18:11:22","date_gmt":"2017-12-11T23:11:22","guid":{"rendered":"http:\/\/lisa.rushworth.us\/?p=1942"},"modified":"2017-12-12T11:22:55","modified_gmt":"2017-12-12T16:22:55","slug":"scraping-openhab-karaf-console-data","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=1942","title":{"rendered":"Scraping OpenHAB Karaf Console Data"},"content":{"rendered":"<p>Realized an easier way of scraping the Karaf console output &#8211; no need to SSH into the console (which, evidently, can timeout for inactivity &#8230; something I sort on my OpenSSH server with a config parameter whenever I&#8217;m looking to use tee and scrape output).<\/p>\n<p>You can just pipe the <em>startup<\/em> script to tee. Have to push stderr into stdout to get the *errors* logged.<\/p>\n<pre>.\/start.sh 2&gt;&amp;1 | tee -a \/tmp\/logfile.txt<\/pre>\n<p>The output gets a little funky &#8211; maybe because of the color flags on some of the text? Dunno, but it&#8217;s grabbing the text and something like tail displays it without funky odd stuff<\/p>\n<pre>ESC[31m ESC[0m __ _____ ____ ESC[0m\r\nESC[31m ____ ____ ___ ____ ESC[0m\/ \/ \/ \/ | \/ __ ) ESC[0m\r\nESC[31m \/ __ \\\/ __ \\\/ _ \\\/ __ \\ESC[0m\/ \/_\/ \/ \/| | \/ __ | ESC[0m\r\nESC[31m\/ \/_\/ \/ \/_\/ \/ __\/ \/ \/ \/ ESC[0m__ \/ ___ |\/ \/_\/ \/ ESC[0m\r\nESC[31m\\____\/ .___\/\\___\/_\/ \/_\/ESC[0m_\/ \/_\/_\/ |_\/_____\/ ESC[0m\r\nESC[31m \/_\/ ESC[0m 2.2.0-SNAPSHOTESC[0m\r\nESC[31m ESC[0m Build #1114 ESC[0m\r\n\r\nHit 'ESC[1m&lt;tab&gt;ESC[0m' for a list of available commands\r\nand 'ESC[1m[cmd] --helpESC[0m' for help on a specific command.\r\nHit 'ESC[1m&lt;ctrl-d&gt;ESC[0m' or type 'ESC[1msystem:shutdownESC[0m' or 'ESC[1mlogoutESC[0m' to shutdown openHAB.\r\n\r\nESC[?1hESC=ESC[?2004hESC[36mopenhab&gt;ESC[0m<\/pre>\n<p>But you get the java exceptions too:<\/p>\n<pre>      Exception in thread \"pool-45-thread-5\" java.lang.NullPointerException\r\n              at java.util.AbstractCollection.addAll(AbstractCollection.java:343)\r\n              at com.zsmartsystems.zigbee.ZigBeeNode.setNeighbors(ZigBeeNode.java:510)\r\n              at com.zsmartsystems.zigbee.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:232)\r\n              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n              at java.lang.Thread.run(Thread.java:748)<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Realized an easier way of scraping the Karaf console output &#8211; no need to SSH into the console (which, evidently, can timeout for inactivity &#8230; something I sort on my OpenSSH server with a config parameter whenever I&#8217;m looking to use tee and scrape output). You can just pipe the startup script to tee. Have &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63,30],"tags":[453,452,44,454],"class_list":["post-1942","post","type-post","status-publish","format-standard","hentry","category-home-automation","category-system-administration","tag-exceptions","tag-logging","tag-openhab","tag-tee"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1942"}],"version-history":[{"count":6,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1942\/revisions"}],"predecessor-version":[{"id":1956,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/1942\/revisions\/1956"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}