每小时的cron工作没有运行

use*_*569 1 linux debugging cron

我打开了我的crontab文件crontab -e.然后我把它添加到我的crontab:

SHELL=/bin/bash

@hourly /home/ec2-user/utilities/create-snapshots.sh
Run Code Online (Sandbox Code Playgroud)

然后我保存了文件.大约一个小时后,显示的是cron日志:

CROND[1876]: (ec2-user) CMD (/home/ec2-user/utilities/create-snapshots.sh)
CROND[1877]: (root) CMD (/usr/lib64/sa/sa1 -S DISK 1 1)
CROND[1892]: (root) CMD (run-parts /etc/cron.hourly)
run-parts(/etc/cron.hourly)[1892]: starting 0anacron
run-parts(/etc/cron.hourly)[1901]: finished 0anacron
Run Code Online (Sandbox Code Playgroud)

但是我知道命令/home/ec2-user/utilities/create-snapshots.sh实际上并没有运行,因为它会创建我的数据库的快照,但它没有./home/ec2-user/utilities/create-snapshots.sh如果我直接在终端中运行该命令,则运行该命令.

我怎样才能让cron每小时运行一次命令?

Gre*_*ill 5

我的通灵调试能力告诉我create-shapshots.sh脚本运行,但由于环境变量问题(可能PATH),它失败了.Cron通常使用清理后的环境运行命令,其内容远少于shell通常提供的内容.