How to Start Cron Automatically in WSL on Windows 11/10 PC – Guide

If you’ve never used cron on Linux to run tasks, check out our tutorial in task scheduling in Linux. For our purposes here, let’s assume you already have cron jobs created in your WSL installation and need help ensuring they are running, rather than keeping cron jobs all the time. For this tutorial we will use sudo service to check and start cron. This is the recommended way to stop and start services on modern versions of Ubuntu, the most popular distribution for WSL. Also note that this tutorial assumes you have administrative rights to your version of WSL. If you are the only user on your PC and you have activated WSL, you have admin rights. Windows offers several ways to automate tasks. The most common tool is the Windows Task Scheduler, but if you are using Windows Subsystem for Linux (WSL) there is also the cron daemon, which runs tasks for the WSL installation in the background. On Windows 10 and Windows 11, cron is included in Linux environments like Ubuntu. The problem is that WSL doesn’t start Cron automatically, which means your automated tasks won’t run by default.

Cron does not run by default

On Windows 10 and Windows 11, cron is included in Linux environments such as Ubuntu. The problem is that WSL cron doesn’t start automatically, which means your automated tasks don’t run by default. To fix this, you can manually start cron every time you open the command line, but manually starting a tool that’s supposed to automate tasks kind of misses the point. Fortunately, there is an easy way to fix this, which requires Task Scheduler.

Preparing Linux

The first thing we need to do is let the computer start cron without a password. When starting a service like cron, use the command But this command requires a password, which Windows cannot access when it boots up. The way around this is to disable the password requirement for this command. To do this, open the WSL terminal window and type

Context up Cron in Windows Task Scheduler

This is the first phase of our journey to cron automation. Let’s move on to part 2 with the Task Scheduler. Tap the Windows key on your keyboard and search for “Task Scheduler”. Launch the “Task Scheduler” shortcut.

Final note

I hope you like the guide How to Start Cron Automatically in WSL on Windows 11/10 PC. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.