Files
Citadel-Station-13-RP/tools/SQLAlertEmail/email_script.ps1
Zandario ed27a01b58 Massive backend updoot: Juke Build, TGUI upgrades, Soft Ping, and too much to list! (#3990)
* Time to become our TGUI God.

* Visually sprucing the copyrights.

These shouldn't be ignored :)

* babababa

* https://github.com/tgstation/tgstation/pull/50422

* dooootdooot

* Holy fuck

Updates the tools folder
Updates our build tooling
Updates TGUI MASSIVELY
I'm going to go scream in a hole now

* ??

* Was it this dum thing?

* orrrr

* It's this isn't it

* Did it manually

* hubah

* TGUI Changelog

* oops

* What if I use the original?

* Lets try this again

* Shit commenting out for now

* asdasd

* Fuck it use the old one and remember to replace later

* Updates yarn.lock

* Lets try something horrid

* Nope it HATES THAT

* fucc

* The great eslinting

* HOLY SHIT

* Final?

* ?

* asd

tgstation/tgstation/pull/59914
tgstation/tgstation/pull/66317

* Improved Asset handling.

* Oops

* Subsystem stuff

* Recompiles the Changelong again.

* Finally Fixed Communicators

* Compiled Changelogs... AGAIN
2022-05-09 18:02:09 -07:00

23 lines
1.1 KiB
PowerShell

<#
This is a script designed to parse through your server logs and locate any SQL errors reported.
If found an email is sent to addresses specified in the configuration file: email_config.ps1.
A SMTP server is required, if you don't have one the defaults for Gmail's can be used.
Suggested use is to schedule this task to be executed daily at server-time midnight so all the day's logs are checked.
You will likely find it helpful to set the configuration file to be untracked by git.
#>
. .\email_config.ps1
$Date = Get-Date -format "yyyy\\MM\\dd"
$Matches = Get-ChildItem "$Path$Date" -recurse -include *.log | Select-String "$StringToMatch" -List | Select Path, Line
$email = New-Object System.Net.Mail.MailMessage
$email.From = $From
foreach($i in $To) {$email.To.Add($i)}
$email.Subject = $Subject
$MatchList = foreach($m in $Matches) {"`t$m`n"}
$email.Body = $Body+"`n"+$MatchList
$smtp = New-Object System.Net.Mail.SmtpClient($SMTPServer, $SMTPPort);
$smtp.Credentials = New-Object System.Net.NetworkCredential($Account, $Password);
$smtp.EnableSSL = $true
$smtp.Send($email);