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:
Code:
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?
I have a PHP Script that works perfectly on a server that uses Sendmail. However I tried to port it to a new server that has the Postfix to Sendmail compatibility interface, and it doesn't work properly.
The php.ini file has the path for sendmail on both servers set to: /usr/sbin/sendmail -t... (0 Replies)
How do you do an ssh on a for statement. I have done ssh on individula lines of code before with no problems.
#!/usr/bin/ksh
cat server_list.txt | while read line
do
ssh $line "for i in `lslpp -l |grep tsm`
do
lslpp -Lc $i |grep -v State |tr ':' ',' |awk -F, '{print $2, "," ,... (4 Replies)
Hi all,
I am facing an issue while trying to access a for loop variable inside ssh. Can anyone please help me with what this issue is, the following is the code that I have ->
IMPL_LOG_FOLDERS=(transaction_logs invalid_transaction_logs)
sshg3 ftp_id@boxname << EOS
for log_folder in... (5 Replies)
Here is the smallest extract to demonstrate the problem that I experience.
#!/bin/bash
r=$1
while read ip
do
if ] ;then
x=`ssh $ip echo "$ip"`
else
x=`echo "$ip"`
fi
echo $x
done << EOF
192.168.8.241
192.168.8.241
EOF
# Any IP with public key set (0 Replies)
I need help on how to connect remote systems through ssh command in while loop of shell script. I was able to connect one remote system using ssh from shell script. Please find sample code snippet as given below…..
ssh "root@148.147.179.100" ARG1=$rpmFileName 'bash -s' <<'ENDSSH'
... (5 Replies)
Hi All,
I've a csv file in which the record is getting break into 1 line or more than one line. I want to combine those splits into one line and remove the unwanted character existing in the record i.e. double quote symbol ("). The line gets break only when the record contains double... (4 Replies)
I have a shell script, and its pretty much done, I decided to add a loop that ends or continues depending on user input. like "would you like to continue?" and if I hit y or yes it will run the loop again until I hit n or no and breaks out of the loop.
To be hones I didn't think I needed to add... (2 Replies)
Hi All,
Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement .
Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks .
We have... (4 Replies)
I am trying to check multiple server's "uptime" in a loop over "ssh".
When I execute multiple ssh commands with hard coded servernames script is executing fine.
But when I pass server names using while loop, script is exiting after checking first server's status, why?
# serverList... (8 Replies)
Discussion started by: kchinnam
8 Replies
LEARN ABOUT SUNOS
asadmin-list-file-groups
asadmin-list-file-groups(1AS) User Commands asadmin-list-file-groups(1AS)NAME
asadmin-list-file-groups, list-file-groups - lists the file groups
SYNOPSIS
list-file-groups --user admin_user [--password admin_password] [--host localhost] [--port 4848] [--secure|-s] [--passwordfile filename]
[--terse=false] [--echo=false] [--interactive=true] [--authrealmname auth_realm_name] [--name username]
Lists the available groups in the file user. If the name option is not specified, then all groups are listed.
This command is supported in remote mode only.
OPTIONS --user authorized domain application server administrative username.
--password password to administer the domain application server.
--host machine name where the domain application server is running.
--port port number of the domain application server listening for administration requests.
--secure if true, uses SSL/TLS to communicate with the domain application server.
--passwordfile file containing the domain application server password.
--terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well-
formatted data for consumption by a script. Default is false.
--echo setting to true will echo the command line statement on the standard output. Default is false.
--interactive if set to true (default), only the required password options are prompted.
--authrealmname filename where you have different stores for file auth realm.
--name name of the file user.
Example 1: Using the list-file-groups command
asadmin> list-file-groups --user admin1 --password adminadmin1
--host pigeon --port 5001 --name sample_user
Command list-file-groups executed successfully
EXIT STATUS
0 command executed successfully
1 error in executing the command
asadmin-delete-file-user(1AS), asadmin-update-file-user(1AS), asadmin-create-file-user(1AS), asadmin-list-file-users(1AS)J2EE 1.4 SDK March 2004 asadmin-list-file-groups(1AS)