问题
I set up some cronjobs a while back using crontab -e
. My crontab includes the following line:
* * * * * /usr/bin/touch /home/blah/MADEBYCRON
It's been weeks since I did this. I have never seen /home/blah/MADEBYCRON
. I set permissions on my home directory so it should be able to create files in this directory, so why does this file never exist?
/var/log/syslog
does not exist.
回答1:
Ensure that the cron service is running. I use WSL with cron every day for my local backups using rsync so this should work.
Use which cron
to check its installed, mine says /usr/sbin/cron
.
Use crontab -l
to list your configured jobs.
Use ps aux | grep cron
to look see if cron is running, you should see /usr/sbin/cron
if it is.
Use service cron status
to check if the service is started.
Use sudo service cron start
to start the cron service if it is not running.
来源:https://stackoverflow.com/questions/60256901/crontab-never-executes-in-windows-subsystem-linux