Skip to content

Instantly share code, notes, and snippets.

@rogfut
Created August 15, 2016 20:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogfut/f2804ad8dcc80df2a36314105792137a to your computer and use it in GitHub Desktop.
Save rogfut/f2804ad8dcc80df2a36314105792137a to your computer and use it in GitHub Desktop.
function Install-Tomcat {
[CmdletBinding()]
param(
# Path to the Tomcat installer exe
[Parameter(Mandatory=$true)]
[string]
$Path,
# Install Destination
[Parameter(Mandatory=$true)]
[ParameterType]
$Destination,
# Service name that the Tomcat service will run as
[Parameter(Mandatory=$false)]
[ValidatePattern("(?i)Tomcat")]
[string]
$ServiceName = "Tomcat7",
# Path to java install
[Parameter(Mandatory=$false)]
[string]
$javapath = $env:java_home,
# Java Options
[Parameter(Mandatory=$false)]
[string[]]
$javaopts,
# When used will update Tomcat instead of doing a clean install
[Parameter(Mandatory=$false)]
[switch]
$Update
)
begin {
#some basic code goes here to test paths, verify params, verifies catalina.jar version
function Get-TomcatStatus {
#checks to see if tomcat already exists at $destination, also checks to see if there is a service with a name like Tomcat already
#returns $TomcatStatus
}
function New-Install {
#some code goes here to do a fresh install after determining the state of Tomcat on the host
}
function Upgrade-Tomcat {
#if the switch -Update is used, it will run a command to update the tomcat options
}
}
process {
If(!($Update)) {
New-Install $path $destination $servicename $javaopts
} else {
Update-Install $path $destination $servicename $javaopts
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment