Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
Següent revisió
Revisió prèvia
software:telegram:start [01/02/2020 15:00] matesoftware:telegram:start [01/02/2020 15:03] (actual) mate
Línia 14: Línia 14:
  
 == shell script == shell script
-<code bash telegram-test.sh>+<code bashtelegram-test.sh>
 #!/bin/bash #!/bin/bash
 function sendTelegram { function sendTelegram {
Línia 35: Línia 35:
 </code> </code>
  
-<code bash>+<code bash; ovh-test>
 #!/bin/bash #!/bin/bash
  
Línia 57: Línia 57:
  
 #curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$MESSAGE" #curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="$MESSAGE"
 +</code>
 +
 +<code bash whois>
 +#!/bin/bash
 +
 +function sendTelegram {
 +
 +local TEXT=$1
 +local SERVER="K0"
 +#local MESSAGE=$2
 +
 +#[[ ! -z "$MESSAGE" ]] && \
 +        curl -s -X POST $URL -d chat_id=$CHAT_ID -d text="*${SERVER}*: $TEXT" -d parse_mode="markdown" >> /tmp/telegram.log
 +
 +}
 +
 +TOKEN=<YOUR_TOKEN_HERE>
 +CHAT_ID=<YOUR_CHAT_ID_HERE>
 +MESSAGE="Hello World"
 +UR
 +L="https://api.telegram.org/bot$TOKEN/sendMessage"
 +
 +#whois mate.cat | grep Date > ./mate.cat.tmp
 +whois mate.cat > ./mate.cat.tmp
 +
 +[[ -f ./mate.cat.txt ]] && {
 +    DIFF=$(diff ./mate.cat.txt ./mate.cat.tmp)
 +    [[ $? != 0 ]] && {
 +        mv ./mate.cat.tmp ./mate.cat.txt
 +        sendTelegram "cambios en mate.cat: \`${DIFF}\`"
 +    } || {
 +        rm ./mate.cat.tmp
 +    }
 +} || {
 +    whois mate.cat > ./mate.cat.txt
 +}
 +
 </code> </code>
  • software/telegram/start.1580598058.txt.gz
  • Darrera modificació: 01/02/2020 15:00
  • per mate