Reliable restart of the weblogic server

Everyone doing CI using an application server knows the problem: After some time you get OutOfMemoryError because of the excessive deployments.

The solution for this is to restart the application server periodically. But before you can start the application server, you must be sure to shut the application server down. This can be done for the weblogic with the script.

But what happens if the application server is already out of memory or has an other problem and is not going to shut down? This can be solved by killing the process on OS level.

Because I don’t want to kill the process always, I have written a script to first shutdown the server gracefully and if it doesn’t work, to kill the process. The script is executed from hudson remotely by a cron rule.


# Hudson doesn't start a login shell, that's why we need to set some environment Variables


echo Trying to stop CI for 60 seconds ...

( ${DOMAIN_HOME}/bin/ ) & sleep 60 ; kill $!

echo Killing CI if not stopped now ...

pkill -f ${DOMAIN_NAME}

echo Waiting 30 seconds ...

sleep 30

rm nohup.out

echo Starting CI ...

nohup ${DOMAIN_HOME}/bin/ 2>&1 &

echo Waiting 3 minutes ...

sleep 180

tail nohup.out

echo Finished!

The script additionally appends the last lines of the server output after the restart to the log of the hudson job.

Bernhard Mähr @ OPITZ-CONSULTING published at

Über bmaehr

Ich bin ein Technik-Fan, der in der Informatik seinen Beruf und seine Berufung gefunden hat.
Dieser Beitrag wurde unter BPM & System Integration, Software Engineering abgelegt und mit , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )


Verbinde mit %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.