{"id":401,"date":"2015-01-31T00:37:59","date_gmt":"2015-01-31T00:37:59","guid":{"rendered":"http:\/\/www.danplanet.com\/blog\/?p=401"},"modified":"2015-01-31T00:37:59","modified_gmt":"2015-01-31T00:37:59","slug":"the-magical-sleeping-development-machine","status":"publish","type":"post","link":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/","title":{"rendered":"The magical sleeping development machine"},"content":{"rendered":"<p>For years now, I&#8217;ve preferred to do all my development on a dedicated machine. This means my desktop (or laptop, depending) is just a glorified terminal-and-editor-running appliance. It probably comes from years of crashing boxes during kernel development, but it is also relevant for something like Nova, where running unit tests will consume all resources. The last thing I want is for unit tests to slow down my email and web browsing activities while I wait for them to complete.<\/p>\n<p>A few years ago, I started automating the sleep activities of my development machine. There&#8217;s really no reason for that box to run all night when I&#8217;m not using it, especially since it&#8217;s beefy (and thus power-thirsty). I used to sleep the machine on a schedule which was mostly compatible with my work schedule. Lately, I&#8217;ve been using the idle times of any login sessions to determine idle-ness and sleeping the box after they pass some threshold. My only-works-for-me hack <a href=\"https:\/\/gist.github.com\/kk7ds\/5f28ce8ba0bc60c8908a\">looks like this<\/a>. This behavior is pretty handy, because once I wake it up, it stays up until I stop using it. At the time I started doing this, I would just have my always-running workstation machine wake it up right before I normally stop working so the box was ready for me in the morning. By putting the MAC of the development box into \/etc\/ethers, all I needed to wake it up was:<\/p>\n<pre style=\"padding-left: 30px;\">$ sudo etherwake theobromine<\/pre>\n<p>The problems with this are:<\/p>\n<ol>\n<li>When I&#8217;m traveling or on vacation, the workstation keeps waking the development box for no reason, unless I remember to disable the cron job.<\/li>\n<li>If I&#8217;m in another timezone accessing the development box remotely, it&#8217;s not online at the right times.<\/li>\n<li>If I needed to wake the machine off schedule, I needed to ssh to an always-on machine on the network and wake it up.<\/li>\n<li>Once I moved my desktop to a platform that can reliably suspend and resume a graphical environment, I stopped having an obvious place to run the wake script.<\/li>\n<\/ol>\n<p><span style=\"font-size: 16px;\">Since the development box sleeps according to lack of demand, what I really wanted was a similar demand-based policy for waking it up. Given that I only access the machine over the network, all I really need was to monitor the network from a machine that is always on, looking for something trying to contact the box. If I know the development box is down and I see such a request, I can issue the wakeup packet on behalf of the demanding machine without it having to know about the sleep schedule. I ended up with <a href=\"https:\/\/gist.github.com\/kk7ds\/48da850ffd3418196ad3\">this<\/a>. The logging looks like this:<\/span><\/p>\n<pre style=\"padding-left: 30px; font-size: 80%;\">2015-01-30 16:04:43,641 INFO Pinging theobromine [192.168.201.150]: Alive: True (46 sec ago)\r\n2015-01-30 16:04:43,658 INFO theobromine seen alive (since 46 sec ago)\r\n\r\n          &lt;sleep occurs&gt;\r\n\r\n2015-01-30 16:06:22,710 INFO Pinging theobromine [192.168.201.150]: Alive: False (94 sec ago)\r\n2015-01-30 16:25:21,065 INFO Pinging theobromine [192.168.201.150]: Alive: False (1232 sec ago)\r\n\r\n          &lt;attempt to ssh to theobromine from desktop&gt;\r\n\r\n2015-01-30 16:26:36,511 DEBUG ARP: 00:01:02:03:04:05 192.168.1.58 -request-&gt; 00:00:00:00:00:00 192.168.1.20\r\n2015-01-30 16:26:36,511 WARNING Waking theobromine\r\n2015-01-30 16:26:36,889 INFO theobromine seen alive (since 1308 sec ago)<\/pre>\n<p>Now, any traffic destined for the development box that generates an ARP request will cause the always-on machine to issue a WoL magic packet to wake it up. That means reconnecting via SSH in the morning, making an edit via Emacs\/Tramp, or even just a ping. Aside from the delay of a few seconds when the machine needs waking, it almost appears to the user as if it never goes to sleep.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For years now, I&#8217;ve preferred to do all my development on a dedicated machine. This means my desktop (or laptop, depending) is just a glorified terminal-and-editor-running appliance. It probably comes from years of crashing boxes during kernel development, but it &hellip; <a href=\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[135,133,43,93,137,131],"class_list":["post-401","post","type-post","status-publish","format-standard","hentry","category-linux","tag-development","tag-etherwake","tag-linux-2","tag-nova","tag-power-management","tag-wol"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The magical sleeping development machine - Right Angles<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The magical sleeping development machine - Right Angles\" \/>\n<meta property=\"og:description\" content=\"For years now, I&#8217;ve preferred to do all my development on a dedicated machine. This means my desktop (or laptop, depending) is just a glorified terminal-and-editor-running appliance. It probably comes from years of crashing boxes during kernel development, but it &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\" \/>\n<meta property=\"og:site_name\" content=\"Right Angles\" \/>\n<meta property=\"article:published_time\" content=\"2015-01-31T00:37:59+00:00\" \/>\n<meta name=\"author\" content=\"Dan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\"},\"author\":{\"name\":\"Dan\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"headline\":\"The magical sleeping development machine\",\"datePublished\":\"2015-01-31T00:37:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\"},\"wordCount\":521,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"keywords\":[\"development\",\"etherwake\",\"linux\",\"nova\",\"power-management\",\"wol\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\",\"url\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\",\"name\":\"The magical sleeping development machine - Right Angles\",\"isPartOf\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#website\"},\"datePublished\":\"2015-01-31T00:37:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.danplanet.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The magical sleeping development machine\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#website\",\"url\":\"https:\/\/www.danplanet.com\/blog\/\",\"name\":\"Right Angles\",\"description\":\"If they&#039;re not right...they&#039;re wrong\",\"publisher\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.danplanet.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c\",\"name\":\"Dan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g\",\"caption\":\"Dan\"},\"logo\":{\"@id\":\"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.danplanet.com\/blog\/author\/dan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The magical sleeping development machine - Right Angles","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/","og_locale":"en_US","og_type":"article","og_title":"The magical sleeping development machine - Right Angles","og_description":"For years now, I&#8217;ve preferred to do all my development on a dedicated machine. This means my desktop (or laptop, depending) is just a glorified terminal-and-editor-running appliance. It probably comes from years of crashing boxes during kernel development, but it &hellip; Continue reading &rarr;","og_url":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/","og_site_name":"Right Angles","article_published_time":"2015-01-31T00:37:59+00:00","author":"Dan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Dan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#article","isPartOf":{"@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/"},"author":{"name":"Dan","@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"headline":"The magical sleeping development machine","datePublished":"2015-01-31T00:37:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/"},"wordCount":521,"commentCount":0,"publisher":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"keywords":["development","etherwake","linux","nova","power-management","wol"],"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/","url":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/","name":"The magical sleeping development machine - Right Angles","isPartOf":{"@id":"https:\/\/www.danplanet.com\/blog\/#website"},"datePublished":"2015-01-31T00:37:59+00:00","breadcrumb":{"@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.danplanet.com\/blog\/2015\/01\/31\/the-magical-sleeping-development-machine\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.danplanet.com\/blog\/"},{"@type":"ListItem","position":2,"name":"The magical sleeping development machine"}]},{"@type":"WebSite","@id":"https:\/\/www.danplanet.com\/blog\/#website","url":"https:\/\/www.danplanet.com\/blog\/","name":"Right Angles","description":"If they&#039;re not right...they&#039;re wrong","publisher":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.danplanet.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/0f6920aa6d63cae437bf8b122200287c","name":"Dan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9b73782704be64dd8c030087af2d1ae0c1dc488cad69093ff0366dbaad2de673?s=96&d=mm&r=g","caption":"Dan"},"logo":{"@id":"https:\/\/www.danplanet.com\/blog\/#\/schema\/person\/image\/"},"url":"https:\/\/www.danplanet.com\/blog\/author\/dan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":3,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"predecessor-version":[{"id":407,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/posts\/401\/revisions\/407"}],"wp:attachment":[{"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.danplanet.com\/blog\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}