{"id":860,"date":"2015-11-09T09:42:13","date_gmt":"2015-11-09T14:42:13","guid":{"rendered":"http:\/\/xfloyd.net\/blog\/?p=860"},"modified":"2015-11-09T09:59:42","modified_gmt":"2015-11-09T14:59:42","slug":"running-cygwin-scripts-as-scheduled-tasks-in-windows","status":"publish","type":"post","link":"https:\/\/xfloyd.net\/blog\/?p=860","title":{"rendered":"Running Cygwin Scripts as Scheduled Tasks in Windows"},"content":{"rendered":"<p>It isn&#8217;t always necessary to run Cron as a service to schedule Cygwin scripts and programs.\u2003As an alternative to using cron, you can run cygwin scripts &amp; programs using Windows Scheduled Tasks.<\/p>\n<p>From the Scheduled Tasks Window, right-click on an empty space and select &#8216;new task&#8217;.\u2003Enter the path to Cygwin, -l, -c, and then the full command surrounded by quotes in the RUN field. e.g.<\/p>\n<pre>c:\\cygwin64\\bin\\bash.exe -l -c \"\/full\/path\/to\/command\/plus-command &gt;&gt; \/full\/path\/to\/a\/logfile 2&gt;&amp;1\"<\/pre>\n<p>Then, in the START IN field enter:<\/p>\n<pre>c:\\cygwin64\\bin<\/pre>\n<p>Add a description and give your task a meaningful name so that when you come back to it in a year you know what it&#8217;s for and you&#8217;re done!<\/p>\n<p>&nbsp;<\/p>\n<p>Breaking this down:<\/p>\n<ul>\n<li>-l\u2003:Run as if logged on at a shell<\/li>\n<li>-c\u2003:Run this command<\/li>\n<li>&gt;&gt; logfile\u2003:Put any output into a text file for troubleshooting<\/li>\n<li>2&gt;&amp;1\u2003:Redirect stderr to stdout (i.e. your logfile &#8211; since you&#8217;ve already redirected stdout to \/full\/path\/to\/a\/logfile)<\/li>\n<\/ul>\n<p>Quick and easy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It isn&#8217;t always necessary to run Cron as a service to schedule Cygwin scripts and programs.\u2003As an alternative to using cron, you can run cygwin scripts &amp; programs using Windows Scheduled Tasks. From the Scheduled Tasks Window, right-click on an empty space and select &#8216;new task&#8217;.\u2003Enter the path to Cygwin, -l, -c, and then the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"_links":{"self":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860"}],"collection":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=860"}],"version-history":[{"count":3,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":863,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/860\/revisions\/863"}],"wp:attachment":[{"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xfloyd.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}