我有一个PHP脚本,我想在Ubuntu中使用Cron作业每2分钟运行一次。我收到以下错误:
bash: */2: No such file or directory
我已完成以下所有步骤以设置Cron作业 请帮我解决错误,我不明白我做错了什么。
1)在我的终端中写下此命令:where is php
输出:
php: /usr/bin/php /usr/bin/X11/php /usr/share/php /opt/lampp/bin/php /usr/share/man/man1/php.1.gz
2)每2分钟运行一次PHP脚本:
*/2 * * * * /usr/bin/php /opt/lampp/htdocs/kyrill/filetest.php
输出:
bash: */2: No such file or directory
答案 0 :(得分:1)
好像你正在执行crontab指令。
执行
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbTransactionDispatcher.Commit(DbTransaction transaction, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.EntityClient.EntityTransaction.Commit()
at System.Data.Entity.DbContextTransaction.Commit()
at BoomerangResellerAPI.DAL.ResellerCustomerFileDAL.DeleteFile(Int32 customerId, Int32 fileId, String& returnMessage) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI.DAL\ResellerCustomerFileDAL.cs:line 325
at BoomerangResellerAPI.BLL.ResellerCustomerFileBLL.DeleteFile(Guid uniqueCustomerId, Int32 fileId, String& returnMessage) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI.BLL\ResellerCustomerFileBLL.cs:line 100
at BoomerangResellerAPI.Controllers.FilesController.TemporaryDelete(Nullable`1 customerUniqueId, Nullable`1 fileId) in D:\Varinder\Working Folder\Boomerang Backup\API\BoomerangResellerAPI\BoomerangResellerAPI\BoomerangResellerAPI\Controllers\FilesController.cs:line 195
编辑你的cron作业。然后在文件末尾添加此行
crontab -e
答案 1 :(得分:0)
试
0/2 * * * * curl http://[your_id:port]/kyrill/filetest.php