Skip to content

Commit

Permalink
RC2
Browse files Browse the repository at this point in the history
  • Loading branch information
botmtl committed Sep 4, 2017
1 parent 9b256f1 commit c6eb49a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions Execute-MySQLScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,7 @@ param

#MySQL command to run
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="Command")]
[string]$Command,

#Defaults to correct MySQLInApp connection string for this instance
#MySQL connector needs a seperate Port= section in the connection string
[Parameter(Mandatory=$false, Position=1)]
[ValidateScript({ -not ($ConnectionString -eq "") })]
[string]$ConnectionString =
[String]::Format("{0}{1}",
"SslMode=none;",
(Get-Content -LiteralPath "D:\home\data\mysql\MYSQLCONNSTR_localdb.txt").Replace(":",";Port="))
[string]$Command
)

#Wake the site up, thereby starting MySQL. (MySQLInApp is started as a subprocess by IIS).
Expand All @@ -28,10 +19,17 @@ $ProgressPreference = "SilentlyContinue"
$curlPath = Invoke-Expression -Command 'cmd /c "where curl"'
$siteUrl = "https://$ENV:WEBSITE_HOSTNAME"
if (-not ([String]::IsNullOrWhiteSpace($curlPath))) {
Invoke-Expression -Command "& $curlPath $siteUrl" -Verbose
Invoke-Expression -Command "& ""$curlPath"" ""$siteUrl""" -Verbose -ErrorAction SilentlyContinue | Out-Null
}
else {
Write-Warning "curl not in path."
}

if (Test-Path "D:\home\data\mysql\MYSQLCONNSTR_localdb.txt") {
$ConnectionString = [String]::Format("{0}{1}", "SslMode=none;", (Get-Content -LiteralPath "D:\home\data\mysql\MYSQLCONNSTR_localdb.txt").Replace(":",";Port="))
}
else {
Write-Debug "curl not in path."
Write-Error "MYSQLCONNSTR_localdb.txt was not found."
}

#Open the MysqlConnection
Expand Down
2 changes: 1 addition & 1 deletion settings.job
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schedule":"0 */4 * * * *"}
{"schedule":"0 */4 * * *"}

0 comments on commit c6eb49a

Please sign in to comment.