Created
August 5, 2012 19:11
-
-
Save munroebot/3266728 to your computer and use it in GitHub Desktop.
Salt Mods for Tomcat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def __catalina_home(path=None): | |
''' | |
Tomcat paths differ depending on packaging | |
''' | |
if (path == None): | |
locations = ['/usr/share/tomcat6', '/opt/tomcat'] | |
else: | |
locations = [path,] | |
for location in locations: | |
if os.path.isdir(location): | |
return location | |
def signal(signal=None, path=None): | |
''' | |
Signals catalina to start, stop, securestart, forcestop. | |
CLI Example:: | |
salt '*' tomcat.signal start | |
''' | |
valid_signals = {'forcestop': 'stop -force', | |
'securestart': 'start -security', | |
'start': 'start', | |
'stop': 'stop'} | |
if not valid_signals[signal]: | |
return | |
cmd = __catalina_home(path) + '/bin/catalina.sh %s' % valid_signals[signal] | |
out = __salt__['cmd.run'](cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment