File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
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
+
You can’t perform that action at this time.
0 commit comments