无法通过 cron 运行服务命令 [英] Unable to run a service command via cron

查看:24
本文介绍了无法通过 cron 运行服务命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

service service_name start

当我尝试从 cmd 行运行它时,它起作用了.但是当我尝试通过 cron 安排它时,我收到一个错误提示

When i tried running this from cmd line, it works. But when i try to schedule it via cron, i get an error saying

/bin/sh: 服务:找不到命令

/bin/sh: service: command not found

推荐答案

sbin 通过 cron 运行时不在路径中.指定 service 的完整路径.这可能是 /sbin/service/usr/sbin/service.您可以通过运行 which service 找到系统上的路径.

sbin is not in the path when run via cron. Specify the full path to service. This is probably either /sbin/service or /usr/sbin/service. You can find the path on your system by running which service.

这篇关于无法通过 cron 运行服务命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆