Ich versuche alle Vorkommen eines Prozesses zu töten, was passiert eigentlich eine Iteration stoppt nach dem ersten Element, was ist hier falsch?Bash-Skript iterieren über PIDs und kill items
#!/usr/bin/env bash
SUPERVISORCLS=($(pidof supervisorctl))
for i in "${SUPERVISORCLS[@]}"
do
echo $i
exec sudo kill -9 ${i}
done
Bevor ich versuchte, etw wie diese als Lösung für restart Skript, sondern auch Skript nicht immer bei insgesamt ausgeführt wurde immer nur ein, wenn Block ausgeführt wurde.?
ERROR0=$(sudo supervisord -c /etc/supervisor/supervisord.conf 2>&1)
if [ "$ERROR0" ];then
exec sudo pkill supervisord
exec sudo supervisord -c /etc/supervisor/supervisord.conf
echo restarted supervisord
fi
ERROR1=$(sudo supervisord -c /etc/supervisor/supervisord.conf 2>&1)
if [ "$ERROR1" ];then
exec sudo pkill -9 supervisorctl
exec sudo supervisorctl -c /etc/supervisor/supervisord.conf
echo restarted supervisorctl
fi