Skip to content

Instantly share code, notes, and snippets.

@robsonpiere
Created December 7, 2018 10:24
Show Gist options
  • Save robsonpiere/b2f317ed15a78397fce0a6d6b82152c8 to your computer and use it in GitHub Desktop.
Save robsonpiere/b2f317ed15a78397fce0a6d6b82152c8 to your computer and use it in GitHub Desktop.
Scripts Utéis para Windows Server
@Echo Off
Set ServiceName=MySQL57
SC queryex "%ServiceName%"|Find "STATE"|Find /v "RUNNING">Nul&&(
echo %ServiceName% Fora do AR
echo Start %ServiceName%
Net start "%ServiceName%">nul||(
Echo "%ServiceName%" não pode ser iniciado
exit /b 1
)
echo %date%-%time% - "%ServiceName%" iniciado com sucesso >> "verifica_servico_%ServiceName%.log"
blat -to "[email protected], [email protected]" -server stmp.x.com -f [email protected] -subject "Tarefa executada no servidor" -body "%ServiceName% iniciado"
exit /b 0
)||(
echo "%ServiceName%" no ar
exit /b 0
)
@robsonpiere
Copy link
Author

Download Blat : http://www.blat.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment