• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

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

Joined
Apr 16, 2023
Messages
167
Reaction score
20
Credits
1,635
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:


Top