Search code examples
windowsbashwindows-10cronwindows-subsystem-for-linux

Scheduling .sh on windows


Recently I downloaded Windows 10 preview for developers with build 1432 that has Ubuntu bash.

I've been trying to schedule jobs in crontab but so far it failed and it's not working. I want to schedule an *.sh script to run. So far nothing is happening.

My crontab entry looks like this:

26 * * * * /mnt/h/Filmy/du.sh

And the script looks like this:

#!/bin/bash
cd /mnt/h/Filmy

du -s | tr -d "\t\r." >> du.txt

I know that is just BETA of this yet but maybe someone has a solution for that. Is there any workaround to schedule .sh scripts on Win10?


Solution

  • As of Windows Insiders Build 17046 you are able to run cron jobs in the background even if the terminal is closed.

    To make sure cron is actually running you can type service cron status. If it isn't currently running then type service cron start and you should be good to go.