Get Windows command-line flags in-line with linux

patch by Josh McKenzie; reviewed by Philip Thompson for CASSANDRA-7748
This commit is contained in:
Joshua McKenzie 2014-09-10 09:10:52 -07:00
parent 9b9bf45b67
commit dbcc4eae6c
1 changed files with 25 additions and 4 deletions

View File

@ -17,7 +17,8 @@ param (
[switch]$install,
[switch]$uninstall,
[switch]$help,
[switch]$verbose,
[switch]$v,
[switch]$s,
[switch]$f,
[string]$p,
[string]$H,
@ -51,8 +52,9 @@ usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-D arg] [-E errorfile
-H change JVM HeapDumpPath
-D items to append to JVM_OPTS
-E change JVM ErrorFile
-v Print cassandra version and exit
-s Show detailed jvm environment information during launch
-help print this message
-verbose Show detailed command-line parameters for cassandra run
NOTE: installing cassandra as a service requires Commons Daemon Service Runner
available at http://commons.apache.org/proper/commons-daemon/"
@ -76,13 +78,18 @@ Function Main
. "$env:CASSANDRA_HOME\bin\source-conf.ps1"
$conf = Find-Conf
if ($verbose)
if ($s)
{
echo "Sourcing cassandra config file: $conf"
}
. $conf
SetCassandraEnvironment
if ($v)
{
PrintVersion
exit
}
$pidfile = "$env:CASSANDRA_HOME\$pidfile"
$logdir = "$env:CASSANDRA_HOME/logs"
@ -195,6 +202,20 @@ Function HandleInstallation
echo "Installation of [$SERVICE_JVM] is complete"
}
#-----------------------------------------------------------------------------
Function PrintVersion()
{
Write-Host "Cassandra Version: " -NoNewLine
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "$env:JAVA_BIN"
$pinfo.UseShellExecute = $false
$pinfo.Arguments = "-cp $env:CLASSPATH org.apache.cassandra.tools.GetVersion"
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$p.WaitForExit()
}
#-----------------------------------------------------------------------------
Function RunCassandra([string]$foreground)
{
@ -211,7 +232,7 @@ $env:JAVA_BIN
$proc = $null
if ($verbose)
if ($s)
{
echo "Running cassandra with: [$cmd $arg1 $arg2 $arg3 $arg4]"
}