#!/bin/bash

for pidfile in $(ls /var/run/fliwi-vhost/*.pid)
do
  pid=$(grep -E -e '^[0-9]+$' $pidfile | head -n 1)
  if [ $(ps -o %a --pid $pid | grep -c -F "pidfile $pidfile") -eq 1 ]; then
    vServerName=$(basename $pidfile .pid)
    fliwi-vhost-update-niceness-of-vserver $vServerName
  fi
done

