Shell script for restarting tomcat


References

startup/shutdown

There are two shell scripts for starting up and shutting down tomcat instance. The former is startup.sh and the latter is shutdown.sh.
It is not a big deal for making another shell script calls these two scripts in a row.

$ cat restart.sh
#!/bin/sh
sh ./shutdown.sh
sh ./startup.sh
$ 

The problem is that this script doesn’t run outside the directory contains the script. You can find a solution for this problem from the link above.

$ cat restart.sh
wd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sh $wd/shutdown.sh
sh $wd/startup.sh
$ 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s