Artificial intelligent assistant

Crontab doesn't find a word 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 This state script works manually fine, but if I execute it with crontab it doesn't. It doesn't find "GRAY" but it is gray. The sap log gets created, so the script gets executed, but it stops at this part of the script with SAP check.

We face this kind of issue while using the packages is not from default RHEL. Cron may not run with the same environment as we run in the foreground.

we may be required to give full path of commands.

locate the path of `sapcontrol` by using the below command.


whereis sapcontrol


it may be /bin/sapcontrol or /usr/local/bin/sapcontrol

update the obtained full path in the script and give a try.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 7003a628ca7e5fc5d23a1548b15fbee9