Checking service status in unix and windows

(imported topic written by SystemAdmin)

I need to check a if a service(windows)/process (Linux) is installed / running / stopped on both linux and windows

I have the windows relevance

if exists service “TSCensus Collection Client” then state of service “TSCensus Collection Client” else “”

I think this should work for linux

if (name of operating system as lowercase contains “linux” AND exist find files “S*tscclient” of folder “/etc/init.d/rc3.d” and exists process whose (name of it as string as lowercase = “tscclient”) then “Running” else “Stopped”)

the question is how would I combine them to get 1 state for both

I want to know if its running or stopped or

(imported comment written by sthull)

Just keep nesting:

if name of operating system starts with “Win” then (if exists service “TSCensus Collection Client” then state of service “TSCensus Collection Client” else “”) else (if name of operating system as lowercase contains “linux” then (if exist find files “S*tscclient” of folder “/etc/init.d/rc3.d” and exists process whose (name of it as string as lowercase = “tscclient”) then “Running” else “Stopped”) else “”)