(servicename)
| 219 | |
| 220 | |
| 221 | def is_service_running(servicename): |
| 222 | try: |
| 223 | o = service(servicename,"status") |
| 224 | if distro is Ubuntu: |
| 225 | # status in ubuntu does not signal service status via return code |
| 226 | if "start/running" in o.stdout: return True |
| 227 | return False |
| 228 | else: |
| 229 | # retcode 0, service running |
| 230 | return True |
| 231 | except CalledProcessError as e: |
| 232 | # retcode nonzero, service not running |
| 233 | return False |
| 234 | |
| 235 | |
| 236 | def stop_service(servicename,force=False): |
no test coverage detected