EvertJob

doorbel_telegram.sh

Jan 19th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.00 KB | None | 0 0
  1. #!/bin/sh
  2. while test $# -gt 0; do
  3.            case "$1" in
  4.                 -camera)
  5.                     shift
  6.                     camera=$1
  7.                     shift
  8.                     ;;
  9.                 -silent)
  10.                     shift
  11.                     silent=$1
  12.                     shift
  13.                     ;;
  14.                 -message)
  15.                     shift
  16.                     message=$1
  17.                     shift
  18.                     ;;
  19.                 *)
  20.                    echo "$1 is not a recognized flag!"
  21.                    return 1;
  22.                    ;;
  23.           esac
  24.   done  
  25. TelegramBotToken=
  26. Chatid=
  27. SnapFile="/var/tmp/camsnapshot.jpg"
  28. wget -O $SnapFile "http://192.168.2.1:80/camsnapshot.jpg?idx="$camera""
  29. # Send Telegram message with image
  30. curl -s -X POST "https://api.telegram.org/bot"$TelegramBotToken"/sendPhoto" -F chat_id=$Chatid -F photo="@$SnapFile" -F disable_notification=$silent -F caption="$message" -F parse_mode="Markdown"
  31. # Remove Image
  32. /bin/rm $SnapFile
Advertisement
Add Comment
Please, Sign In to add comment