The Task Scheduler enables you to automatically perform routine tasks on a chosen computer. Task Scheduler does this by monitoring whatever criteria you choose and then executing the tasks when those criteria are met.

In the Task Scheduler press the Windows key on the keyboard and search for “Task Scheduler” then Open the shortcut for “Task Scheduler.”

After opening the window look under the task there is a “Create Basic Task” click on it.

This will open the Basic Task Wizard. First, it’s going to ask you to name the task and give it a description. You can enter whatever you want here. We called the task “Cron” and the description is, “A task to start Cron at system startup” then click on Next.

In the other section, the window wants to know when we want to run the task here you will choose the “When the Computer Starts” button and then click on next.

In this section, we want “Start a Program” and click on the Next button

In the next section, we have to specify the program that we want to run, which is WSL. Enter the

Program or Script into the text entry box as shown in the diagram: C:\Windows\System32\wsl.exe

Here we can also need to add some arguments since all we’ve done so far is start WSL, but inside WSL, we need to tell Ubuntu to start Cron. So, in the Argument box add: sudo /usr/sbin/service cron start

Then click on Next.

In this section check the box “Open the properties dialog for this task when I click Finish” and then click on the Finish button.

The task is created, but we have to do one final thing to make sure that everything works. A new window will open, which shows the summary of the task that you created, but it’s only set to run when you’re logged on. We need to select the radio button that says “Run Whether User Is Logged On Or Not” and then press “OK”.

Now, let’s test our task in two ways. First, in the main window of the Task Scheduler, scroll down until you see your task name. If you used the name “Cron” it should be found toward the top of the list. Right-click the task and select “Run”.

Then, go back to your WSL terminal and type in sudo service Cron status, and it should say that Cron is running. If it isn’t, double-check that you entered everything correctly in the previous steps.

Leave a Reply

Your email address will not be published.