Crontab永远不会在Windows子系统Linux中执行 [英] Crontab never executes in Windows Subsystem Linux
问题描述
我使用 crontab -e
设置了一些cronjobs.我的crontab包含以下行:
I set up some cronjobs a while back using crontab -e
. My crontab includes the following line:
* * * * * /usr/bin/touch /home/blah/MADEBYCRON
距离我这样做已经有几个星期了.我从未见过/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
不存在.
推荐答案
确保cron服务正在运行.我每天都使用cron将WSL与cron一起使用rsync进行本地备份,因此应该可以使用.
Ensure that the cron service is running. I use WSL with cron every day for my local backups using rsync so this should work.
使用哪个cron
来检查其安装,我说/usr/sbin/cron
.
Use which cron
to check its installed, mine says /usr/sbin/cron
.
使用 crontab -l </code>列出您配置的作业.
Use crontab -l
to list your configured jobs.
使用 ps aux |grep cron
查看cron是否正在运行,如果是,则应该查看/usr/sbin/cron
.
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.
使用 sudo服务cron start
启动cron服务(如果未运行).
Use sudo service cron start
to start the cron service if it is not running.
这篇关于Crontab永远不会在Windows子系统Linux中执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!