sid="GR1"
if sapcontrol -prot PIPE -nr $sid -prot PIPE -function GetSystemInstanceList | grep 'GRAY' >> $LOGFILE
then
echo "STATE: SAP system is offline. (sapcontrol)" >> $LOGFILE
echo "STATE: SAP system is offline. (sapcontrol)"
else
echo "ERROR: SAP system is still online. (SAP system has to be online)" >> $LOGFILE
echo "ERROR: SAP system is still online. Check the logs. (sapcontrol)"
exit 1
fi这个状态脚本手动工作很好,但是如果我用crontab执行它,它不会。它不会找到" gray“,但是它是灰色的。sap日志被创建,因此脚本被执行,但是它会在脚本的这一部分使用SAP检查停止。
发布于 2020-02-20 11:01:21
我们面临这样的问题,而使用包不是来自默认的RHEL。Cron的运行环境可能与我们在前台运行的环境不同。
我们可能被要求给出完整的命令路径。
使用下面的命令找到sapcontrol的路径。
whereis sapcontrol 它可以是/bin/皂甙,也可以是/usr/local/bin/边防器。
更新脚本中获得的完整路径并试一试。
https://unix.stackexchange.com/questions/568681
复制相似问题