ASPL Manual v 1.00
© 2024 by SetSphere.COM


12-14

   Script pathcompare.aspl

Comparing the similarity between the system ENV of two hosts can be effectively done by representing each host's ENV by its dataset then by calculating the similarity between the two datasets. The following script compare the system ENV of two computer hosts.


       [Top Text]

 -L- Listing. 12.14.1   [LISTING pathcompare.aspl][ASPL Script pathcompare.aspl]
(raw text)
1.     #!/usr/bin/env /opt/ASPLv1.00/bin/aspl
2.     #ENVARG= -groupingclass POSIX -wsname TRANSIENT -singlepass  
3.     
4.     ;;***********************************************************************
5.     ;;   pathcompare.aspl
6.     ;;   Compare PATH on Two Remote Hosts in a cloud environment
7.     ;;   Copyright © 2024 Bassem W. Jamaleddine
8.     ;;
9.     ;;***********************************************************************
10.    
11.    endScriptIfShellArgsLessThan 2
12.    
13.    DEF FN cmp2sets := {gU {g\, %%1 %%2}{g\, %%2 %%1}{g&, %%1 %%2}}
14.    
15.    timeout 300
16.    displayoff
17.    
18.    print ** GETTING $1 ENV
19.    p1 = ggpathR(grp1,$1,hostname,$1,ENVNAME,PATH)
20.    
21.    print ** GETTING $2 ENV
22.    p2 = ggpathR(grp1,$2,hostname,$2,ENVNAME,PATH)
23.    
24.    displayon
25.    ks chksum size mtime ffl
26.    
27.    print ############################################
28.    print # SHOWING SET COMPARISONS BETWEEN $1 and $2 
29.    print ############################################
30.    FN cmp2sets(p1,p2)
31.    print ############################################
32.    print # SHOWING SET INTERSECTION WITH DIFFERENT CHECKSUMS BETWEEN $1 and $2 
33.    print ############################################
34.    f&`c~ p1 p2
35.    print ############################################
36.    print # SHOWING SET SIMILARITY BETWEEN $1 and $2 
37.    print ############################################
38.    sim p1 p2
39.    sim`c p1 p2
40.    sim`f p1 p2
41.    sim`ffl p1 p2
42.    println
43.    
44.    endscript
45.    
46.    __END__
47.    
48.      $00 Compare PATH on Two Remote Hosts in a Cloud
49.    
50.      $00 must be followed by two remote hosts
51.    
52.      Example: To compare the PATH on two UNIX hosts  mm01 and mm02
53.    
54.        $00  mm01 mm02
55.    

ASPL(C) 2024 Bassem Jamaleddine


The following figure shows the result when comparing system PATH between hosts mm01 and vienna.

This example is shown in the following terminal.

       display or terminal for Example: Script pathcompare.aspl
viewme

 -E- Display. 12.14.1   [Script pathcompare.aspl][Script pathcompare.aspl]
run for pathcompare-aspl-links