Created
August 13, 2020 16:23
-
-
Save MatheusMuriel/511e44cc3d47de5efef7a36b50728a12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'json' | |
require 'fileutils' | |
require 'logger' | |
set :port, 6000 | |
diretorio_repo = '/home/Muriel/JarvisBot/' | |
caminho_logs = '/home/Muriel/Logs/post-reciver/' | |
$LOG = Logger.new("#{caminho_logs}/log_file.log", 20, 'daily') | |
$LOG.debug("Post reciver iniciado!") | |
post '/jarvis' do | |
$LOG.debug(" ") | |
$LOG.debug("Recebido um payload de push") | |
$LOG.debug("Bip! Bop!... Atualizando o Jarvis") | |
system('systemctl stop jarvisbot.service') | |
FileUtils.cd(diretorio_repo) do | |
$LOG.debug("git pull --rebase") | |
system('git pull --rebase') | |
end | |
system('systemctl start jarvisbot.service') | |
$LOG.debug("Bip! Bop!... Atualização concluida") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment