Skip to content

Instantly share code, notes, and snippets.

@MatheusMuriel
Created August 13, 2020 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatheusMuriel/511e44cc3d47de5efef7a36b50728a12 to your computer and use it in GitHub Desktop.
Save MatheusMuriel/511e44cc3d47de5efef7a36b50728a12 to your computer and use it in GitHub Desktop.
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