Programming Control in Jython
The if-else construct in Jython Syntax: if condition1 : true statements elif condition2 : true condition2 statements else: false statements Example: In your monitoring scripts you might need for the variable must be cross check across multiple servers. Assuming that you got the JVM Valules using if condition statements find which server is having more Java objects occupied. # This script illustrates the if-else-elif usage print "Enter 3 server JVM Size in MB: " s1, s2, s3= input('3 integer values') print "Given JVM Values:", s1, s2, s3 print '#'*50 if s1 > s2 and s1 >s3: print s1, " s1 JVM server overloaded" elif s2 > s1 and s2 > s3: print s2, " s2 jvm overloaded" elif s3 > s1 and s3 > s2: print s3, " s3 JVM Overloaded" else: print "Error in input plz check" print '#'*50 Output: wsadmin>execfile('/home/vagrant/scripts/ifel...