[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

To check the User Id's have correct Primary Group and Secondary Group for all the user's on ISP1(server) and ISP2(server) on all the Given Stores.

Asked by katcse786 in KornShell (ksh)

Tags: Korn Shell Scripting To check the User Id's have correct Primary Group and Secondary Group for all the user's on ISP1(server) and ISP2(server) on all the Given Stores.

To check the User Id's have correct Primary Group and Secondary Group for all the user's on ISP1(server) and ISP2(server) on all the Given Stores.
I have script written, it needs to be modified, In this Script the Output file Generated needs to be checked manually. So What I am told, is to add some logic and make the script to detect automatically how many User Id's are having Wrong primary Group and Secondary Group for ISP1 and ISP2 on all the given Stores.
I need a script inside the given code such that the outputfiles final_file and final_file_ne are searched and the User Id's with wrong primary group and Seconday group for ISP1 and ISP2 on all the given stores are categorized automatically, Showing each of the User Id's with Wrong and Right Primary Group and Secondary Group in more easy form.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
I have script written, it needs to be modified, In this Script the Output file Generated needs to be checked manually. So What I am told, is to add some logic and make the script to detect automatically how many User Id's are having Wrong primary Group and Secondary Group for ISP1 and ISP2 on all the given Stores.
 The Script Code that is already written is as follows:
 
#!/bin/ksh
# This is a variable that contains all the user-id's that are to be checked at all stores.     
 id="db2inst1 db2fenc1 dasusr1 s0998cjf s0998gp4 s0998jm7 s0998ap1 s0998cm1 s0998ms4 s0998vs1 s0998ch2 s0998lw2 s0998bhb s0998dj2 s0998mrg s0998amj s0998rrh s0998gs4 s0998pd7"
#This is a variable that contains all the stores numbers.                                       #
str_no="0116 0124 0499 0529 0772 1188 1684 2773 2825 2855"
 
for store_number in `echo "${str_no}"`
   do
     if [ [ -a isp1_final_id_$store_number ] && [ -a isp1_final_id_${store_number}_exist ] && [ -a isp1_final_id_${store_number}_not_exist ] ]
 
then
 
    rm -f isp1_final_id_$store_number isp1_final_id_${store_number}_exist isp1_final_id_${store_number}_not_exist
 
    touch isp1_final_id_$store_number isp1_final_id_${store_number}_exist isp1_final_id_${store_number}_not_exist
 
    else
 
    touch isp1_final_id_$store_number isp1_final_id_${store_number}_exist isp1_final_id_${store_number}_not_exist
 
fi
 
if [ [ -a isp2_final_id_$store_number ] && [ -a isp2_final_id_${store_number}_exist ] && [ -a isp2_final_id_${store_number}_not_exist ] ]
 
then
 
    rm -f isp2_final_id_$store_number isp2_final_id_${store_number}_exist isp2_final_id_${store_number}_not_exist
 
    touch isp2_final_id_$store_number isp2_final_id_${store_number}_exist isp2_final_id_${store_number}_not_exist
 
    else
 
    touch isp2_final_id_$store_number isp2_final_id_${store_number}_exist isp2_final_id_${store_number}_not_exist
 
fi
 
done
 
for userid in `echo "${id}"`
 
 do
  for store_number in `echo "${str_no}"`
  do
    ssh isp1.$store_number lsuser $userid 1> isp1_final_id_${store_number}_exist 2>> isp1_final_id_${store_number}_not_exist
    cut -f 1,4,3 -d " " isp1_final_id_${store_number}_exist >> isp1_final_id_$store_number
    ssh isp2.$store_number lsuser $userid 1> isp2_final_id_${store_number}_exist 2>> isp2_final_id_${store_number}_not_exist
    cut -f 1,4,3 -d " " isp2_final_id_${store_number}_exist >> isp2_final_id_$store_number
done
done
 
if [ [ -a final_file ] && [ -a final_file_ne ] ]
 
then
 
    rm -f  final_file final_file_ne
    touch  final_file final_file_ne
 
    else
 
    touch final_file final_file_ne
 
fi
 
for userid in `echo "${id}"`
 
do
 
 for store_number in `echo "${str_no}"`
 
 do
    grep $userid isp1_final_id_$store_number > /dev/null 2>&1
    grep $userid isp2_final_id_$store_number > /dev/null 2>&1
    if [ $? == 0 ]; then
 
    echo "User: $userid at ISP1.$store_number and ISP2.$store_number" >> final_file
    grep $userid isp1_final_id_$store_number >> final_file
    grep $userid isp2_final_id_$store_number >> final_file 
    echo "________________________________________________" >> final_file
    else
   
    echo "User: $userid at ISP1.$store_number does not exist." >> final_file_ne
    echo "User: $userid at ISP2.$store_number does not exist." >> final_file_ne
    echo "__________________________________________________" >> final_file_ne
fi
done
done
 
for store_number in `echo "${str_no}"`
do
 rm -f isp1_final_id_${store_number}
 rm -f isp1_final_id_${store_number}_exist
 rm -f isp2_final_id_${store_number}
 rm -f isp2_final_id_${store_number}_exist
 rm -f isp1_final_id_${store_number}_not_exist
 rm -f isp2_final_id_${store_number}_not_exist
done
Attachments:
 
Script for the User Id's and Groups Provisioning which needs to be modified as per need such that it checks every thing Automatically and displays
 
[+][-]11/09/09 02:41 AM, ID: 25774741Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625