-
-
Save akamajoris/f37085886984f288227527e9952d34ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
BOTID='' #change me | |
MYID='108474952' #change me | |
echo "Run command: " $* | |
#start=`date +%s` | |
res1=$(date +%s.%N) | |
$* | |
res2=$(date +%s.%N) | |
dt=$(echo "$res2 - $res1" | bc) | |
dd=$(echo "$dt/86400" | bc) | |
dt2=$(echo "$dt-86400*$dd" | bc) | |
dh=$(echo "$dt2/3600" | bc) | |
dt3=$(echo "$dt2-3600*$dh" | bc) | |
dm=$(echo "$dt3/60" | bc) | |
ds=$(echo "$dt3-60*$dm" | bc) | |
dur=`printf "%dd:%02dh:%02dm:%02fs\n" $dd $dh $dm $ds` | |
curl -s -H "Content-Type: application/json" https://api.telegram.org/bot$(echo $BOTID)/sendMessage -d "{\"chat_id\":$(echo $MYID),\"text\": \"Finished ($(echo $dur)): $(echo $(printf '%s\n' $*))\"}" > /dev/null 2&>1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment