Page 1 of 1

Shell: Bash Script führt While Schleife nicht aus

Posted: 2006-10-13 08:53
by [gca].dfritz
Hallo zusammen,

ich habe ein Problem mit dem unten angegebenen Bash-Script.

Ich habe in Mappe1.csv einige Server drin stehen, die nun abgearbeitet werden sollen in der WHILE Schleife. Leider steigt das Script immer nach dem letzte SSH Kommando zum Prompt aus ohne Fehler.

Führe ich allerdings den obrigen ECHO Kram aus, funktioniert es. Hat jemand dafür eine Erklärung oder ggf. einen Tipp ?

Gruß Daniel



Code: Select all

#!/bin/bash

count=1

cat Mappe1.csv > /dev/null

while read LINE
do
sger=`echo $LINE | cut -d ";" -f1`
hostname=`echo $LINE | cut -d ";" -f2 | cut -d" " -f1`

echo "Server ist : $hostname und SGER ist $sger"

echo "# Parameterdatei fuer xxxxxxxxxxxxx, bitte nur gueltige Wertepaare anlegen." > ./conf/$hostname.conf
echo "# z.B.:" >> ./conf/$hostname.conf
echo "# system_id=xxxxxxxxx" >> ./conf/$hostname.conf
echo "# ap=FE2000" >> ./conf/$hostname.conf
echo "# os=HPUX11" >> ./conf/$hostname.conf
echo "# Servername=$hostname" >> ./conf/$hostname.conf
echo "ap=xxxxxx" >> ./conf/$hostname.conf
echo "os=Linux" >> ./conf/$hostname.conf
echo "system_id=$sger" >> ./conf/$hostname.conf

ssh root@$hostname /bin/mkdir /etc/epmf
scp conf/$hostname.conf root@$hostname:/etc/epmf/
scp install.sh root@$hostname:/etc/epmf/
ssh root@$hostname /bin/mv /etc/epmf/$hostname.conf /etc/epmf/xxxx.cfg
scp xxxxxxx.tar root@$hostname:/tmp
ssh root@$hostname /bin/tar xf /tmp/xxxxx.tar
# ssh root@$hostname /etc/epmf/install.sh

done < Mappe1.csv

Re: Shell: Bash Script führt While Schleife nicht aus

Posted: 2006-10-13 10:51
by Joe User

Code: Select all

ssh root@$hostname /bin/sh /etc/epmf/install.sh