千家信息网

如何解决crontab中command not found问题

发表于:2025-11-16 作者:千家信息网编辑
千家信息网最后更新 2025年11月16日,这篇文章将为大家详细讲解有关如何解决crontab中command not found问题,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。# 查看定时任
千家信息网最后更新 2025年11月16日如何解决crontab中command not found问题

这篇文章将为大家详细讲解有关如何解决crontab中command not found问题,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

# 查看定时任务列表crontab -l

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

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

安装依旧报错:

Total download size: 92 kInstalled size: 215 kDownloading 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 checkRunning transaction testTransaction test succeededRunning transaction  Installing : cronie-1.4.11-23.el7.x86_64                                                                                                          1/1 Error unpacking rpm package cronie-1.4.11-23.el7.x86_64error: 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

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

查看Linux定时任务:

#查看定时任务crontab -l

关于如何解决crontab中command not found问题就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

0