Could you please suggest on how to execute Linux command through Python to Start & Stop SAP Host Agent.
Path: .(/usr/sap/hostctrl/exe)
To stop hostagent: ./saphostexec -stop
To start hostagent: ./saphostexec -start
Could you please suggest on how to execute Linux command through Python to Start & Stop SAP Host Agent.
Path: .(/usr/sap/hostctrl/exe)
To stop hostagent: ./saphostexec -stop
To start hostagent: ./saphostexec -start
we can use the os module of python to do it.
import os
os.chdir('/usr/sap/hostctrl/exe')
# for starting hostagent
os.system("./saphostexec -start pf=host_profile")
# to know the status of hostagent
os.system("./saphostexec -status pf=host_profile")
# for stopping hostagent
os.system("./saphostexec -start pf=host_profile")