Skip to content

Commit d7fefed

Browse files
committed
Like ps on Unix/Linux
Gives a more formatted detailed display, need to make a small change so it checks the OS first
1 parent e62f91b commit d7fefed

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pscheck.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Script Name : pscheck.py
2+
# Author : Craig Richards
3+
# Created : 19th December 2011
4+
# Last Modified :
5+
# Version : 1.0
6+
7+
# Modifications :
8+
9+
# Description : Process check on Nix boxes, diplsay formatted output from ps command
10+
11+
import commands, os, string
12+
13+
program = raw_input("Enter the name of the program to check: ")
14+
15+
try:
16+
#perform a ps command and assign results to a list
17+
output = commands.getoutput("ps -f|grep " + program)
18+
proginfo = string.split(output)
19+
20+
#display results
21+
print "\n\
22+
Full path:\t\t", proginfo[5], "\n\
23+
Owner:\t\t\t", proginfo[0], "\n\
24+
Process ID:\t\t", proginfo[1], "\n\
25+
Parent process ID:\t", proginfo[2], "\n\
26+
Time started:\t\t", proginfo[4]
27+
except:
28+
print "There was a problem with the program."
29+
30+

0 commit comments

Comments
 (0)