Skip to content

Instantly share code, notes, and snippets.

@joepreludian
Created September 30, 2013 13:29
Show Gist options
  • Save joepreludian/6763814 to your computer and use it in GitHub Desktop.
Save joepreludian/6763814 to your computer and use it in GitHub Desktop.
Que tal conferir se um site mudou de status? Fui realizar uma inscrição pra minha noiva e o site estava com uma mensagem de erro. Criei um shellscript que checava no site se ele tinha voltado a funcionar. Usei o cURL e o md5 pra fazer uma assinatura da mensagem. No exemplo ele preenche um formulário, enviando para o site do cadastro, identifican…
#!/bin/bash
say -r 190 "Up and running. Listening website for changes. I will keep You in touch. Bye.";
while [ 1 ]
do
get_status=$(curl -X POST "http://www.pm.pb.gov.br/concursos/inscricao__cfo/index.php" -d "dt_nascimento=01/01/1987" -d "nm_cpf=xxx.xxx.xxx-xx" -A "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36" -d "modo=1" -d "cd_aluno=" -s | md5);
if [ $get_status = "e5948a465a078db264bb770ccea87510" ]
then
echo "Nothing new. Trying in 5 minutes...";
sleep 300;
else
echo "TIME TO CHECK!!";
while [ 1 ]
do
say -r 190 "Jonathan, wake up! Check the website now! High priority!";
sleep 5;
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment