简体   繁体   English

Centos Crontab错误命令

[英]Centos Crontab Bad Command

I have a pretty simple db back-up script that runs perfectly from shell. 我有一个非常简单的数据库备份脚本,可以从shell完美运行。

php /home/db_backup/db_backup.php

When I attempt to add a Crontab, I get the vague 'Bad Command errors in crontab, can't install." 当我尝试添加Crontab时,出现了模糊的“ crontab中的错误命令错误,无法安装。”

I've tried w/ php and full path to php. 我试过w / php和php的完整路径。

which php

returns /usr/bin/php 返回/ usr / bin / php

* 1 * * * php /home/db_backup/db_backup.php

* 1 * * * /usr/bin/php /home/db_backup/db_backup.php

Both return the same error. 两者都返回相同的错误。

Centos 6.6. Centos 6.6。 logged in as root. 以root用户身份登录。 Editing crontab thusly 从而编辑crontab

crontab -e

Spent too many hours trying to get this working. 花了太多时间试图使它正常工作。 What am I missing? 我想念什么?

I bet your problem is when editing the crontab file not with the commands itself. 我敢打赌,您的问题是在不使用命令本身编辑crontab文件时。

Be sure to let a blank line at the end of file. 确保在文件末尾留空行。

I mean the cursor must be in an empty line after the last entry. 我的意思是光标必须在最后一个条目之后空行。

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

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