{"id":3956,"date":"2022-01-11T14:00:53","date_gmt":"2022-01-11T22:00:53","guid":{"rendered":"https:\/\/34.205.26.201\/?p=3956"},"modified":"2022-01-10T06:56:21","modified_gmt":"2022-01-10T14:56:21","slug":"scheduled-vs-supervised-tasks","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=3956","title":{"rendered":"Scheduled vs Supervised Tasks"},"content":{"rendered":"<p>Scheduling tasks in Linux is traditionally done with the Cron Task Scheduler.\u00a0 There are many online resources about cron, one of which is this site, <a href=\"https:\/\/www.vultr.com\/docs\/how-to-use-the-cron-task-scheduler\/\">https:\/\/www.vultr.com\/docs\/how-to-use-the-cron-task-scheduler\/<\/a>.\u00a0 With Webmin, the task scheduling can be managed through the WebUI.\u00a0 Details can be found here, <a href=\"https:\/\/doxfer.webmin.com\/Webmin\/Scheduled_Cron_Jobs\">https:\/\/doxfer.webmin.com\/Webmin\/Scheduled_Cron_Jobs<\/a>.\u00a0\u00a0 Here is a simple scheduled task that reboots the Linux host daily at 1:30am.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">30 1 * * * systemctl reboot -i<\/pre>\n<p>Scheduling this in Cron or through Webmin results in the same entry in the respective crontab file.<\/p>\n<p>Some tasks are poorly designed, or implemented in a way that they weren&#8217;t intended for.\u00a0 In those instances, the process can do some strange things.\u00a0 This can result in a process hang, memory leak, or cascading processes that exhaust system resources, to name some examples.\u00a0 Restarting those processes is a quick and dirty workaround, but by no means a fix.\u00a0 This is where scheduled tasks can be leveraged.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">13,28,43,58\u00a0*\u00a0*\u00a0*\u00a0*\u00a0node-red-restart<\/pre>\n<p>Some tasks don&#8217;t lend themselves well to automated scheduling, one of them being RTL433.\u00a0 This particular example, <a href=\"https:\/\/www.cloudacm.com\/?p=3501\">https:\/\/www.cloudacm.com\/?p=3501<\/a>, would run for a period of time, but then stop for one reason or another.\u00a0 Here is where Supervisor has been demonstrated to help keep tasks running, <a href=\"https:\/\/www.hagensieker.com\/wordpress\/2019\/03\/06\/how-to-keep-rtl_433-alive-for-your-home-automation-using-supervisor\/\">https:\/\/www.hagensieker.com\/wordpress\/2019\/03\/06\/how-to-keep-rtl_433-alive-for-your-home-automation-using-supervisor\/<\/a>.\u00a0 Depending on the extensive use of Supervisor, some might argue that each task have its own conf file with the command parameters contained in each.\u00a0 Here is an example of a conf file located in this path, \/etc\/supervisor\/conf.d\/rtl443.conf.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">[program:rtl433]\r\ncommand=\/bin\/sh \/home\/local\/Tasks\/RTL433-MQTT.sh\r\nautostart=true\r\nautorestart=true\r\nstartretries=100\r\nstderr_logfile=\/var\/log\/rtl433\/rtl433.err.log\r\nstdout_logfile=\/var\/log\/rtl433\/rtl433.out.log<\/pre>\n<p>Everyone is free to do as they see fit, whether they see it that way or not, consequence is secondary.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Scheduling tasks in Linux is traditionally done with the Cron Task Scheduler.\u00a0 There are many online resources about cron, one of which is this site, https:\/\/www.vultr.com\/docs\/how-to-use-the-cron-task-scheduler\/.\u00a0 With Webmin, the task scheduling can be managed through the WebUI.\u00a0 Details can be found here, https:\/\/doxfer.webmin.com\/Webmin\/Scheduled_Cron_Jobs.\u00a0\u00a0 Here is a simple scheduled task that reboots the Linux host daily at 1:30am. 30 1 * * * systemctl reboot -i Scheduling this in Cron or through Webmin results in the same entry in the respective&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=3956\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-3956","post","type-post","status-publish","format-standard","hentry","category-rd"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3956"}],"version-history":[{"count":17,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3956\/revisions"}],"predecessor-version":[{"id":5333,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3956\/revisions\/5333"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3956"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}