#!/bin/bash

lst=${1:-liste}
umgebung=a.ol.dvag.com
key=XYZ

c=0
while read uid; do
    echo "$(date +%F-%T) init $uid"
    e="$(ssh cloudappa01.$umgebung sudo -u tomcat5 -i sh /usr/local/veritasfs/appsrvcloudA0/auroraCloudUsercommands.sh INIT_VB $uid $key 2>/dev/null)"
    echo "$e" | grep -q "ResultCode.:.OK"
    if [ $? -ne 0 ]; then
        echo "$(date +%F-%T) FAIL $uid - $e" | tr -d \\n
        echo
        continue
    fi
    echo "$(date +%F-%T) wait $uid"
    ssh cloudstoragea01.$umgebung 'while :; do e=$(curl -s http://cloudstoragea01.'$umgebung:8098/riak/ac.$uid.v3.1/SYNC_STATUS_$uid'); echo $(date +%F-%T) stat '$uid' - $e; if [ "$e" == "INIT_DONE" ]; then break; else sleep 5; fi; done'
done < $lst

Add a code snippet to your website: www.paste.org