From b2ded04dae18ea6b8d7b73a659627d638818a55c Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Wed, 10 Oct 2018 08:42:59 +0200 Subject: [PATCH] openstack: add status_process function Signed-off-by: Kyr Shatskyy --- .../openstack/openstack-teuthology.init | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/teuthology/openstack/openstack-teuthology.init b/teuthology/openstack/openstack-teuthology.init index 4fe668ae82..15f2a459e0 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 -- 2.39.5