请教下,我这个crontab写的有问题吗?咋手动可以执行自动不行呢?

RSOA-avatar

RSOA

2024-11-06T14:28:54+00:00

[root@ser667150311178 ~]# crontab -e
10 10 * * * /root/06-163
16 16 * * * /root/06-163
20 20 * * * /root/06-163


自己写的,已经用了几年了,换了台服务器,用不了了
手动可以执行,自动执行不了
RSOA-avatar

RSOA

[root@ser667150311178 ~]# date
Tue Nov 12 10:35:21 PM CST 2024

时区也没啥问题
joyul-avatar

joyul

报错信息没有,你让网友算命呢
oodle99-avatar

oodle99

检查下~/.bash_profile和/etc/profile看
Given-avatar

Given

看看crontab的日志
edgerunner-avatar

edgerunner

缺失了默认执行软件吗,要么你就写 bash /root/06-163呗,或者/usr/...../python3 /root/06-163这样的咯
RSOA-avatar

RSOA

+ by [h11y11] (undefined)

看看crontab的日志


看日志10点的时候好像执行了一下,但16 20点都没执行,早上搞的
Weedologist-avatar

Weedologist

我记得要输入一个crontab -start试试
RSOA-avatar

RSOA

+ by [崎瑾] (undefined)

我记得要输入一个crontab -start试试
[root@ser667150311178 ~]# crontab -start
crontab: invalid option -- 't'
crontab: usage error: unrecognized option
Usage:
crontab [options] file
crontab [options]
crontab -n [hostname]

Options:
-u <user>  define user
-e        edit user's crontab
-l        list user's crontab
-r        delete user's crontab
-i        prompt before deleting
-n <host>  set host in cluster to run users' crontabs
-c        get host in cluster to run users' crontabs
-T <file>  test a crontab file syntax
-s        selinux context
-V        print version and exit
-x <mask>  enable debugging

Default operation is replace, per 1003.2

刚才又添加了一个23点40的任务。并没有执行
[root@ser667150311178 ~]#

10 10 * * * /root/06-163
16 16 * * * /root/06-163
20 20 * * * /root/06-163

40 23 * * * /root/06-163


MiniGoku7-avatar

MiniGoku7

+ by [h11y11] (undefined)

看看crontab的日志

按照5楼老哥说的做
lilpeewee-avatar

lilpeewee

没写shebang吗?