Skip to content

Instantly share code, notes, and snippets.

@munroebot
Created August 5, 2012 19:11
Show Gist options
  • Save munroebot/3266728 to your computer and use it in GitHub Desktop.
Save munroebot/3266728 to your computer and use it in GitHub Desktop.
Salt Mods for Tomcat
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