重大公告:2023年阿里云双11服务器限时大降价(1核2G1年仅需49元+2核4G1年100元) 速度点击查看!!!

crontab: command not found解决方法

2,654次阅读
没有评论
# 查看定时任务列表
crontab -l

报错提示:- bash: crontab: command not found

# 安装之前,先删除
 yum remove cronie
# 安装cronie
 yum -y  install cronie  

安装依旧报错:

Total download size: 92 k
Installed size: 215 k
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
cronie-1.4.11-23.el7.x86_64.rpm                                                                                                  |  92 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : cronie-1.4.11-23.el7.x86_64                                                                                                          1/1 
Error unpacking rpm package cronie-1.4.11-23.el7.x86_64
error: unpacking of archive failed on file /etc/cron.d/0hourly;60a90564: cpio: open
  Verifying  : cronie-1.4.11-23.el7.x86_64                                                                                                          1/1 

Failed:
  cronie.x86_64 0:1.4.11-23.el7                                                                                                                         

报错提示:

Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

发现需要安装deltarpm

yum -y install deltarpm

安装deltarpm成功之后继续安装 yum -y install cronie

新的报错提示:

Error unpacking rpm package cronie-1.4.11-23.el7.x86_64
error: unpacking of archive failed on file /etc/cron.d/0hourly;60a90661: cpio: open

解决方法【去除特殊属性-i -a】:

[root@iZuf6bm7y86rsciyk4lvriZ ~]# find / -name "crontab"
/var/lib/docker/overlay2/ef655c7ec12a300ff857c07225d0556025f494da1755aa038c88b86fbd876ccf/diff/usr/bin/crontab
/etc/crontab
[root@iZuf6bm7y86rsciyk4lvriZ ~]# lsattr /etc/crontab
----ia-------e-- /etc/crontab
[root@iZuf6bm7y86rsciyk4lvriZ ~]# chattr -i -a /etc/crontab
[root@iZuf6bm7y86rsciyk4lvriZ ~]# lsattr /etc/crontab

去除特殊属性
chattr -i -a /etc/crontab

然后重新安装:yum -y install cronie

crontab:
然后可以执行命令,安装成功。

查看Linux定时任务:

#查看定时任务
crontab -l

crontab:

原文地址:https://www.yundashi168.com/278.html

arison
版权声明:本站原创文章,由arison2021-05-22发表,共计2745字。
转载提示:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(没有评论)