2

This command work manually in WSL Ubuntu but not in cron. Manually it is:

touch /var/www/html/myFile.sh

By cron every minute it is:

* * * * * touch /var/www/html/myFile.sh

Why it's not effective when in cron?

1 Answers1

2

WSL does not provide a complete Ubuntu environment by default - in particular, it may not start all the conventional system services. At least at the time of writing this answer, cron seems to be one of those, as discussed in this /r/bashonubuntuonwindows/ thread

Crontab Not Working with Bash on Ubuntu on Windows

The suggested solution is to start the service manually: on WSL that is done1 by

service cron start

1 despite being based on Ubuntu 16.04, WSL does not appear to use systemd

steeldriver
  • 142,475