当前位置: 首页 > article >正文

记一次宝塔centos出现Failed to start crond.service: Unit crond.service not found.解决

问题描述

我遇到的是执行systemctl start crond.service 就报错Failed to start crond.service: Unit crond.service not found.,执行systemctl status crond.service 又正常(虽然显示status里的服务是没启动的,但是status的功能是正常执行了),理论上如果crond.service不存在应该两个都报错,就很有迷惑性,看了网上很多人的说法众说纷纭,有说把systemctl目录带全执行start,有说字节重新start、有说卸载然后安装再start,在我这里都不凑效,依然三start报错status又正常

看效果
[xxxx@xxxx-centos ~]#systemctl status crond.service
● crond.service
   Loaded: not-found (Reason: Unit crond.service not found.)
   Active: failed (Result: resources) since Sat 2024-11-09 09:13:31 CST; 18min ago
 Main PID: 3588034 (code=exited, status=0/SUCCESS)
    Tasks: 42 (limit: 97394)
   Memory: 248.7M
   CGroup: /system.slice/crond.service
           ├─ 215598 /usr/local/qcloud/YunJing/YDEyes/YDService
           ├─ 215688 /usr/local/qcloud/YunJing/YDLive/YDLive
           ├─ 396691 /usr/local/qcloud/stargate/bin/sgagent -d
           ├─2059147 barad_agent
           ├─2059148 barad_agent
           └─2059149 barad_agent

Nov 09 09:13:19 VM-0-5-centos systemd[1]: This usually indicates unclean terminati>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: crond.service: Found left-over process 2>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: This usually indicates unclean terminati>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: crond.service: Failed to load environmen>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: crond.service: Failed to run 'start' tas>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: crond.service: Failed with result 'resou>
Nov 09 09:13:19 VM-0-5-centos systemd[1]: Failed to start Command Scheduler.
Nov 09 09:13:31 VM-0-5-centos systemd[1]: crond.service: Service RestartSec=100ms >
Nov 09 09:13:31 VM-0-5-centos systemd[1]: crond.service: Failed to schedule restar>
Nov 09 09:13:31 VM-0-5-centos systemd[1]: crond.service: Failed with result 'resou>
[xxxx@xxxx-centos ~]#systemctl start crond.service
Failed to start crond.service: Unit crond.service not found.

搞了老半天,网络上的解决方案全都试了一遍,完全不行,再三思考额如果status能成就证明文件肯定存在(忘记service所在目录了没去考证),那也就是说start有问题咯,又想到好像之前有用到郭很多次systemctl有一个重新加载的功能, systemctl daemon-reload 试了一下 果然成了这里贴出来供大家参考,效果如下:

[xxxx@xxxx-centos ~]# systemctl daemon-reload
[xxxx@xxxx-centos ~]# systemctl start crond.service
[xxxx@xxxx-centos ~]# systemctl status crond.service
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: >
   Active: active (running) since Sat 2024-11-09 09:33:02 CST; 10s ago
 Main PID: 689058 (crond)
    Tasks: 45 (limit: 97394)
   Memory: 267.5M
   CGroup: /system.slice/crond.service
           ├─ 215598 /usr/local/qcloud/YunJing/YDEyes/YDService
           ├─ 215688 /usr/local/qcloud/YunJing/YDLive/YDLive
           ├─ 396691 /usr/local/qcloud/stargate/bin/sgagent -d
           ├─ 689058 /usr/sbin/crond -n
           ├─2059147 barad_agent
           ├─2059148 barad_agent
           └─2059149 barad_agent

Nov 09 09:33:02 VM-0-5-centos systemd[1]: This usually indicates unclean terminati>
Nov 09 09:33:02 VM-0-5-centos systemd[1]: crond.service: Found left-over process 2>
Nov 09 09:33:02 VM-0-5-centos systemd[1]: This usually indicates unclean terminati>
Nov 09 09:33:02 VM-0-5-centos systemd[1]: crond.service: Found left-over process 2>
Nov 09 09:33:02 VM-0-5-centos systemd[1]: This usually indicates unclean terminati>
Nov 09 09:33:02 VM-0-5-centos systemd[1]: Started Command Scheduler.
Nov 09 09:33:02 VM-0-5-centos crond[689058]: (CRON) STARTUP (1.5.2)
Nov 09 09:33:02 VM-0-5-centos crond[689058]: (CRON) INFO (RANDOM_DELAY will be sca>
Nov 09 09:33:02 VM-0-5-centos crond[689058]: (CRON) INFO (running with inotify sup>
Nov 09 09:33:02 VM-0-5-centos crond[689058]: (CRON) INFO (@reboot jobs will be run>

宝塔相关

我这边使用的是宝塔,即使上面这些都正常了在宝塔面板的计划任务顶部依然会出现检测到计划任务服务失败什么的,直接点后面的一键修复按钮,然后等待几分钟没报错就证明成了,(之前上面服务没修复时点一键修复,提示一堆修复失败)


http://www.kler.cn/a/386855.html

相关文章:

  • 844.比较含退格的字符串
  • LeetCode 86.分隔链表
  • 曹操为什么总是亲征
  • uniapp使用scroll-view下拉刷新与上滑加载
  • 【练习案例】30个 CSS Javascript 加载器动画效果
  • 微擎框架php7.4使用phpexcel导出数据报错修复
  • YOLOv11融合[ECCV2024]自调制特征聚合SMFA模块及相关改进思路|YOLO改进最简教程
  • 使用ookii-dialogs-wpf在WPF选择文件夹时能输入路径
  • 「Mac畅玩鸿蒙与硬件31」UI互动应用篇8 - 自定义评分星级组件
  • Flink on YARN是如何确定TaskManager个数的
  • [spark面试]spark与mapreduce的区别---在DAG方面
  • CI_CD
  • LabVIEW气体检测系统
  • 【Android】组件化开发入门
  • java-web-苍穹外卖-day2-上:测试阶段区分+开发工具区分
  • 在CentOS 7上安装Alist
  • 【elkb】kibana后台删除索引
  • Android OpenGL ES详解——纹理:纹理过滤GL_NEAREST和GL_LINEAR的区别
  • jmeter常用配置元件介绍总结之函数助手
  • Virtual Box 安装 Deepin 系统
  • Ubuntu 修改时区 同步时间
  • lua入门教程:lua函数
  • 【嵌入式开发——Linux操作系统】8进程间通信IPC和内核同步
  • C# 中的 IntPtr
  • C++设计模式结构型模式———代理模式
  • 【计网不挂科】计算机网络期末考试——【选择题&填空题&判断题&简述题】题库(3)