(process_name, pidFile)
| 146 | return StatusCodes.FAILED |
| 147 | |
| 148 | def checkProcessRunningStatus(process_name, pidFile): |
| 149 | printd("checking the process " + process_name) |
| 150 | cmd = '' |
| 151 | pids = [] |
| 152 | cmd = 'pidof ' + process_name |
| 153 | printd(cmd) |
| 154 | |
| 155 | #cmd = 'service ' + process_name + ' status' |
| 156 | pout = Popen(cmd, shell=True, stdout=PIPE) |
| 157 | exitStatus = pout.wait() |
| 158 | temp_out = pout.communicate()[0].decode() |
| 159 | |
| 160 | #check there is only one pid or not |
| 161 | if exitStatus == 0: |
| 162 | pids = temp_out.strip().split(' ') |
| 163 | printd("pid(s) of process %s are %s " %(process_name, pids)) |
| 164 | |
| 165 | #there is more than one process so match the pid file |
| 166 | #if not matched set pidFileMatched=False |
| 167 | printd("Checking pid file") |
| 168 | if isPidMatchPidFile(pidFile, pids) == StatusCodes.SUCCESS: |
| 169 | return True,pids |
| 170 | |
| 171 | printd("pid of exit status %s" %exitStatus) |
| 172 | |
| 173 | return False,pids |
| 174 | |
| 175 | def restartService(service_name): |
| 176 |
no test coverage detected