Reputation: 2859
One of our application servers (Glassfish v3.0.1) keeps crushing down with no reason. Sometimes, I am away from Internet so I cannot run it back again. Therefore, I wrote a simple bash script to wait for 10 minutes and then run asadmin. It is like:
#!/bin/bash
while true;
do sleep 600;
sudo /home/ismetb/glassfishv3.0.1/glassfish/bin/asadmin start-domain;
done
This seems to work fine however I have a couple of problems:
start-domain
and stop-domain
commands do not work at all. That means, I can neither stop Glassfish nor can I access it. I do not know if anybody else experienced this problem before or not. If the process dies, only thing I can do is to look for the ID of Java process and kill it from terminal. This not desirable at all. Any ideas why Java process dies when I quit script?start-domain
command will successfully work. Any ideas or any directions on how I can do this? Upvotes: 2
Views: 1181
Reputation: 74058
You can use a cron
job instead. To install a cron job for root, enter
sudo crontab -e
and add this line
*/10 * * * * /home/ismetb/glassfishv3.0.1/glassfish/bin/asadmin start-domain
This will run asadmin
every ten minutes.
If you're not comfortable with the command line, you might also try gnome-schedule
, but I have no experience with that.
For your second problem, you can use curl
or wget
to access glassfish. You can try to get some URL, or even access the administration interface, and if you don't get a response, assume glassfish is down.
Upvotes: 2