hello all,
i have an AIX6.1 machine and INFORMIX 11.7 database server.
i have a script to create users on 3 machines and also i need to grant this user access to a specific database. the script works and it does what i want it to do but the loop doesnt work. for example if i insert 10 lines in my input file to create 10 different users it only executes the first line. i suspect that this should have something to do with ssh cause i really cannot find any other explanation.
here is the script:
while read SEMGROUP SEMBANKDIR COOPUSER DBNAME;
do
echo " $a Creating user for server machine1 $b "
if `sudo mkuser pgrp=$SEMGROUP groups="$SEMGROUP" su='false' home=/$SEMBANKDIR/login/$COOPUSER pwdwarntime='3' histexpire='8' maxage='4' minlen='8' minalpha='2' minother='2' maxrepeats='2' gecos=$COOPUSER umask='002' $COOPUSER`
then
echo $COOPUSER:$COOPUSER |sudo chpasswd
cd /$SEMBANKDIR/login/
sudo chmod -R 771 $COOPUSER
echo " $a User $COOPUSER created successfully on machine1 $b "
else
echo " $a Problem in creating user $COOPUSER on machine1 $b "
fi
echo "------------------------------------------------------------------"
echo " $a Creating user for server machine2 $b "
if `sudo ssh machine2 sudo mkuser pgrp="$SEMGROUP" groups="$SEMGROUP,bank" su='false' login='false' rlogin='false' home=/sem/login/deltausers pwdwarntime='3' histexpire='8' maxage='4' minlen='8' minalpha='2' minother='2' maxrepeats='2' gecos=$COOPUSER umask='002' $COOPUSER`
then
sudo ssh machine2 echo $COOPUSER:$COOPUSER |sudo chpasswd
cd /sem/login/informix/
$INFORMIXDIR/bin/dbaccess $DBNAME@tcp_semids << q
grant connect to '$COOPUSER';
grant dbpermissions to '$COOPUSER';
grant DEFAULT ROLE dbpermissions to '$COOPUSER';
q
cd -
echo " $a User $COOPUSER created successfully on machine2 $b "
else
echo " $a Problem in creating user $COOPUSER on machine2 $b "
fi
echo "---------------------------------------------------------------------"
echo " $a Creating user for server machine3 $b "
if `sudo ssh machine3 sudo mkuser pgrp=$SEMGROUP groups="$SEMGROUP" su='false' home=/$SEMBANKDIR/login/$COOPUSER pwdwarntime='3' histexpire='8' maxage='4' minlen='8' minalpha='2' minother='2' maxrepeats='2' gecos=$COOPUSER umask='002' $COOPUSER`
then
sudo ssh machine3 echo $COOPUSER:$COOPUSER |sudo chpasswd
sudo ssh machine3 sudo chmod -R 771 /$SEMBANKDIR/login/$COOPUSER
echo " $a User $COOPUSER created successfully on machine3 $b "
else
echo " $a Problem in creating user $COOPUSER on machine3 $b "
fi
done
i cannot figure out why the loop is not executed.
any ideas?
thank you