Script to Automatically Start a glassfish domain once it's down?

Joined
Apr 16, 2023
Messages
149
Reaction score
16
Credits
1,460
Steps to reproduce this issue:

1) Glassfish domain called domain1 goes down.

2) Now, start that domain again.

Assume there are multiple domains, around 8 of them And different servers have varying amount of domains. Also there are some domains that either are named "backup" or named with "*_bak" should not be started. Also the domains that have numbers in it should be avoided to start. Also the domains that have *.tar.gz or *.tar extension should not be started. Anything named "watchdog" should not be started. Anything named "domains_mpf" should not be started. Anything named "admin_newlive" also should not be started.

My pseudocode:
Code:
    domain_array = get list of all domains in an array
    
    for (i = 0; i < domain_array.length; i++)
    
    {
        if (path / to / asadmin stop - domain domain_array[i] == 0 && domain_array[i] != (list of excluded domains)) //assuming exit code 0 returns if the domain is already stopped
        {
            path / to / asadmin start - domain domain_array[i];
        } else
    
        {
            do nothing
        }
    
    }

    Output of asadmin list-domains
    abcd running
    efgh running
    ijkl running
    mnop running
    qrst running
    uvwx running
    uvwx_bak not running
    wxyz not running
 
Last edited:

Members online


Latest posts

Top