OpenVZ Forum


Home » General » Support » *SOLVED* see processes belonging to the Host system
Re: see processes belonging to the Host system [message #4548 is a reply to message #4544] Fri, 14 July 2006 09:54 Go to previous messageGo to previous message
aistis is currently offline  aistis
Messages: 77
Registered: September 2005
Location: Kaunas, Lithuania
Member

here's a "poor mans vzps" in bash:

#!/bin/bash

PIDLIST=(`ps ax | grep -v PID | awk '{print $1}'`)

findpids(){
veidesired=$1
pidlist=

for i in `seq 0 ${#PIDLIST[*]}`; do
        pid=${PIDLIST[$i]}
        [ -f /proc/$pid/status ] || return
        veid=`grep envID /proc/$pid/status | awk -F: '{print $2}'`
        if [ ${veid} = ${veidesired} ]; then
                pidlist=$(echo $pidlist $pid) 
        fi
done
}

findpids $2
if [ "${pidlist}" ]; then
        ps $1 -p "$pidlist"
fi

exit 0


takes 'ps' arguments and VE ID as a second one, example:

./ovzps fvw 10000
Razz


Aistis Zenkevicius
http://static.openvz.org/userbars/openvz-user.png
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: *HARDWARE* Node crashed with Machine Check Exception error
Next Topic: Gentoo Kernel Problems (2.6.8-openvz-022.077) Panics Immediately - "kernel too old"
Goto Forum:
  


Current Time: Fri Aug 15 21:47:32 GMT 2025

Total time taken to generate the page: 0.83224 seconds