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

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

问题描述

service service_name start
当我试图从cmd行运行它,它的工作原理。但是当我尝试通过cron安排它,我得到一个错误,说
/ bin / sh:service:command not found

service service_name start 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: service: command not found

推荐答案

sbin 不在路径中,通过cron运行。指定 service 的完整路径。这可能是 / sbin / service / usr / sbin / 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天全站免登陆