Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

restarting script

 
Wiesel Mueller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
i would like to create a script which stop jboss and postgresql and firstly start postgresql then jboss.

That's not difficult but often jboss runs on server2 and postgresql on server1.

if the script would like to start jboss via ssh on server2, jboss isn't shutdown in this time.

Is it possible to check with the script on server1, that jboss is shut down before jboss will be restarted.

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wiesel, welcome to Java Ranch!

I usually use "ps -ef | grep java" to see what Java apps are running. You could further refine that to "ps -ef | grep org.jboss.Main". This works OK if you run a single instance; if you run multiple instance you should also grep for the configuration name (e.g. "...| grep '-c defult'")
 
Wiesel Mueller
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
but what's the script code to check this.
I would like that a cronjob will check it, and if jboss is shut down completly, than the script will start jboss again.

Does Jboss doesn't have function for this?

JBoss can also check on start for a running instance of jboss, if the instance is existing jboss won't start.

Best regards
Wiesel
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the run.sh script, it actually restarts JBoss AS under certain situations. You should be able to modify the script to do what you want.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic