How to get the service status before running in gradle script?


Hi All,

I hava written build script which is to install all softwares but i have a issue , if I run that script second time I have to verify is this service

is already installed or not but bdont know how to get the service the status.

Based on service status only i have to install again.

Below code snippet is used to run the service

task startHttpService(dependsOn: EacProperties) << { exec { commandLine=[‘cmd’,’/c’,“Sc start “endecahttpservice””] } }

If i run build script second time build is going to failed because service is already running.

Could anybody please help me to get the service status into a variable ASAP.

Thanks In Advance