From: Kyr Shatskyy Date: Wed, 10 Oct 2018 06:42:59 +0000 (+0200) Subject: openstack: add status_process function X-Git-Tag: 1.1.0~301^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1219%2Fhead;p=teuthology.git openstack: add status_process function Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/openstack/openstack-teuthology.init b/teuthology/openstack/openstack-teuthology.init index 4fe668ae8..15f2a459e 100755 --- a/teuthology/openstack/openstack-teuthology.init +++ b/teuthology/openstack/openstack-teuthology.init @@ -88,6 +88,15 @@ function rkill() { echo Killing process $pid kill -9 $pid } +function status_process() { + local name=$1 + local pidf=$2 + [[ -f $pidf ]] && { + PID=$(cat $pidf) + STATUS=$(ps aux --no-headers -q $PID 2>&1 > /dev/null && echo running || echo dead) + echo $name PID:$PID STATUS:$STATUS + } +} function stop_process() { local pidfile=$1 @@ -117,13 +126,11 @@ case $1 in start-workers) start_workers ;; - list-workers) + status-workers|list-workers) for i in $(ls /var/run | grep teuthology-worker | sort) ; do - WPID=$(cat /var/run/$i) WORKER=${i##teuthology-worker.} WORKER=${WORKER%%.pid} - STATUS=$(ps aux --no-headers -q $WPID 2>&1 > /dev/null && echo running || echo dead) - echo $WORKER PID:$WPID STATUS:$STATUS + status_process "worker $WORKER" /var/run/$i done ;; stop-workers) @@ -137,6 +144,9 @@ case $1 in $0 stop-workers $1 start-workers ;; + status-pulpito) + status_process pulpito /var/run/pulpito.pid + ;; start-pulpito) su - -c "cd /home/$user/pulpito ; virtualenv/bin/python run.py" $user > /var/log/pulpito.log 2>&1 & \ echo $! > /var/run/pulpito.pid @@ -145,6 +155,9 @@ case $1 in echo Stopping pulpito stop_process /var/run/pulpito.pid ;; + status-paddles) + status_process paddles /var/run/paddles.pid + ;; start-paddles) su - -c "cd /home/$user/paddles ; virtualenv/bin/pecan serve config.py" $user > /var/log/paddles.log 2>&1 & echo $! > /var/run/paddles.pid