我无法杀死 crond - 试图停止 cron 服务

我无法杀死 crond - 试图停止 cron 服务

这很令人沮丧,我尝试:

service crond status

并得到这个:

Redirecting to /bin/systemctl status  crond.service
crond.service - Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled)
Active: active (running) since Thu 2015-06-25 07:44:35 UTC; 1 months 21 days ago
Main PID: 2557 (crond)
CGroup: /system.slice/crond.service
└─2557 /usr/sbin/crond -n

Aug 14 21:18:37 li958-202.members.linode.com crond[2557]: 2015-08-14 21:18:37 1ZQMLV-0004ER-HX User 0 set for local_delivery transport is on the neve...ers list
Aug 14 21:18:37 li958-202.members.linode.com crond[2557]: 2015-08-14 21:18:37 1ZQMN3-0004ST-Nr User 0 set for local_delivery transport is on the neve...ers list
Aug 15 21:18:19 li958-202.members.linode.com crond[2557]: 2015-08-15 21:18:19 1ZQip4-0005iq-BH User 0 set for local_delivery transport is on the neve...ers list
Aug 15 21:18:19 li958-202.members.linode.com crond[2557]: 2015-08-15 21:18:19 1ZQiqJ-0005va-CF User 0 set for local_delivery transport is on the neve...ers list
Aug 16 00:35:01 li958-202.members.linode.com crond[2557]: (CRON) OPENDIR FAILED (/var/spool/cron): No such file or directory
Aug 16 01:49:57 li958-202.members.linode.com systemd[1]: Started Command Scheduler.
Aug 16 01:50:09 li958-202.members.linode.com systemd[1]: Started Command Scheduler.
Aug 16 02:08:01 li958-202.members.linode.com crond[2557]: (CRON) INFO (running with inotify support)
Aug 16 02:09:01 li958-202.members.linode.com crond[2557]: (CRON) INFO (running with inotify support)
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Hint: Some lines were ellipsized, use -l to show in full.

然后我在 SO 和其他地方搜索时尝试了所有这些:

kill -1 2557
kill -HUP 2557
service crond stop

没有什么作品。有人能帮忙吗?

答案1

kill -1是一个将发送 SIGHUP 信号的命令,这意味着 pid 大于 1 的所有进程都会收到信号。

你需要的是kill -9 2557。该-9参数向所需进程发送 SIGKILL 信号,以确保该进程被终止。

如果您的系统安装了该程序,则还有其他选择:

pkill crond
killall crond

答案2

根据您得到的输出的第一行(“ redirecting to...”),您正在使用 systemd,因此许多旧的 SysV 命令将不起作用。

用于systemctl管理 systemd 服务。

您需要发出停止命令的命令cron是:systemctl stop crond.service。如果您想禁用它,请执行以下操作systemctl disable crond.service

有关如何管理 systemd 单元的更多信息,请参阅man systemctl

相关内容