找不到从cronjob命令运行的bash脚本

编程入门 行业动态 更新时间:2024-10-25 22:34:30
本文介绍了找不到从cronjob命令运行的bash脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的crontab如下:

my crontab is as follows:

SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ 01 04 * * * root /home/sphinx_scripts/daily_update_index.sh

daily_update_index.sh如下:

daily_update_index.sh is as follows:

indexer --rotate xxx

现在,如果我从任何地方(作为根用户)运行/home/sphinx_scripts/daily_update_index.sh,它都可以正常工作。但是我每天从cron作业收到电子邮件,说找不到命令索引器。索引器的完整路径是/ usr / loca / bin / indexer。为什么会出现这样的错误?

now if I run /home/sphinx_scripts/daily_update_index.sh from anywhere(as root), it works fine. But I get emails daily from cron job saying "command indexer is not found". the full path of the indexer is /usr/loca/bin/indexer. Why would I get such an error?

推荐答案

问题是索引器不在路径上。您说它是/ usr / loca / bin / indexer amd PATH = / sbin:/ bin:/ usr / sbin:/ usr / bin 为了解决这个问题,我会将整个索引器路径放​​在daily_update_index.sh中,或者将/ usr / local / bin添加到daily_update_index.sh中的路径

The issue is that indexer is not on the path. You say it is /usr/loca/bin/indexer amd PATH=/sbin:/bin:/usr/sbin:/usr/bin To fix this I would put the whole path to indexer in daily_update_index.sh or add /usr/local/bin to the path in daily_update_index.sh

更多推荐

找不到从cronjob命令运行的bash脚本

本文发布于:2023-07-16 04:08:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1117691.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   脚本   命令   cronjob   bash

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!