()
| 20 | |
| 21 | |
| 22 | def ps(): |
| 23 | program = input("Enter the name of the program to check: ") |
| 24 | |
| 25 | try: |
| 26 | # perform a ps command and assign results to a list |
| 27 | output = commands.getoutput("ps -f|grep " + program) |
| 28 | proginfo = string.split(output) |
| 29 | |
| 30 | # display results |
| 31 | print( |
| 32 | "\n\ |
| 33 | Full path:\t\t", |
| 34 | proginfo[5], |
| 35 | "\n\ |
| 36 | Owner:\t\t\t", |
| 37 | proginfo[0], |
| 38 | "\n\ |
| 39 | Process ID:\t\t", |
| 40 | proginfo[1], |
| 41 | "\n\ |
| 42 | Parent process ID:\t", |
| 43 | proginfo[2], |
| 44 | "\n\ |
| 45 | Time started:\t\t", |
| 46 | proginfo[4], |
| 47 | ) |
| 48 | except: |
| 49 | print("There was a problem with the program.") |
| 50 | |
| 51 | |
| 52 | def main(): |