{"id":186,"date":"2021-01-13T02:51:07","date_gmt":"2021-01-13T02:51:07","guid":{"rendered":"https:\/\/www.larry4u.com\/co2diy.com\/?page_id=186"},"modified":"2021-01-16T21:39:40","modified_gmt":"2021-01-16T21:39:40","slug":"create-a-crontab-job","status":"publish","type":"page","link":"https:\/\/www.larry4u.com\/co2diy.com\/diy-make-big-screen-monitor\/contents\/create-a-crontab-job\/","title":{"rendered":"Create a crontab job"},"content":{"rendered":"<h3>Create a crontab job<\/h3>\n<ul>\n<li>A cron job is an automated program developed for Unix and Linux systems. It allows the user to execute several commands at a specific time on a precise date.<\/li>\n<li>We need to run the python script scd30.py every minute. To do that, we use the command crontab.<\/li>\n<li>\u201ccrontab \u2013l\u201d (that is, lowercase &#8220;L\u201d lists what is in the file, and crontab \u2013e lets us edit or add new jobs.<\/li>\n<li>Type crontab \u2013e<\/li>\n<li>It now asks what editor to use.<\/li>\n<li>\/bin\/nano works much like note pad.<\/li>\n<li>vim is used mostly by gurus.<\/li>\n<li>ed is an ancient editor.<\/li>\n<li>If new to Unix, use nano.<\/li>\n<li>For SCD30 Sensor add these lines at the end:<\/li>\n<li>\n<pre>* * * * * python3 \/home\/pi\/scd30.py &gt; \/home\/pi\/cron.log\r\n* * * * * python3 \/home\/pi\/readCSV.py &gt; \/home\/pi\/CSV.log\r\n<\/pre>\n<p>For the Aranet4 sensor add these lines at the end<\/p>\n<ul>\n<li>\n<pre>* * * * * python3 \/home\/pi\/aranet_MM.py &gt; \/home\/pi\/cron.log\r\n* * * * * python3 \/home\/pi\/readCSV.py &gt; \/home\/pi\/CSV.log\r\n* * * * * python \/home\/pi\/aranet\/aranet.py D4:E3:1A:E6:D4:AD &gt; \/home\/pi\/aranet.txt\r\n\r\nFor the aranet.py use the MAC address found for Aranet4 device.<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<li>This will run the python script every minute and update the following files \u201ccurrent.txt\u201d, &#8220;left_current&#8221;, &#8220;aranet.txt which the Magic Mirror app reads. Also will update the daily history file in the data_folder.<\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.larry4u.com\/co2diy.com\/notes\/\">NEXT<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create a crontab job A cron job is an automated program developed for Unix and Linux systems. It allows the user to execute several commands at a specific time on a precise date. We need to run the python script <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/www.larry4u.com\/co2diy.com\/diy-make-big-screen-monitor\/contents\/create-a-crontab-job\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":133,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":""},"_links":{"self":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/186"}],"collection":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/comments?post=186"}],"version-history":[{"count":7,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/186\/revisions"}],"predecessor-version":[{"id":302,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/186\/revisions\/302"}],"up":[{"embeddable":true,"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/pages\/133"}],"wp:attachment":[{"href":"https:\/\/www.larry4u.com\/co2diy.com\/wp-json\/wp\/v2\/media?parent=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}