繁体   English   中英

Cron作业调度在Ubuntu中不起作用

[英]Cron job scheduling is not working in ubuntu

1)我在路径/ home / killer / Desktop / alok / scripts / test1中有一个脚本sp19.sh

#script to copy file 1 in test dir
a=`ls -t|cut -c 1,4|head -1`
b=`expr $a + 1`
cp "$a"  "$b"

2)我计划使用crontab中的以下代码在同一位置复制名为1的文件的任务,但这不起作用。

m h  dom mon dow   command
* * * * * /home/killer/Desktop/alok/scripts/test1/sp19.sh

3)我已经测试过sp19.sh正确并生成了文件,但cron作业不起作用。

谢谢

将您的Cron表达式更改为

0 0/1 * 1/1 * ? *

这将使其每隔一分钟运行一次。

如果不起作用,您可以在这里看看

https://askubuntu.com/q/2368

问题出在脚本文件上 正确的脚本应该是

#cript to copy file 1 in test dir
a=`ls /home/killer/Desktop/alok/scripts/test1 -t|cut -c 1,4|head -1`
b=`expr $a + 1`
cp "/home/killer/Desktop/alok/scripts/test1/$a" "/home/killer/Desktop/alok/scripts/test1/$b"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM