作者smailzhu (Ka-ui)
看板Linux
標題[問題] motion跟sh跟py還有telegram bot的問題
時間Mon Aug 21 12:58:09 2017
小弟我在Rpi上裝了
motion(搭配logetic C310)當監視系統
主要是照這篇做的
https://goo.gl/A8Phe1
(
https://blog.gtwang.org/ 的網站)
在motion 的 on_picture_save 事件呼叫一個sh檔
#!/bin/bash
# 名稱:picture_save.sh
# 說明:將儲存的照片以 Email 發送
filename=$1
mpack -s "發現變動畫面" $filename <email address>
python send_pic_tel_bot.py $filename
send_pic_tel_bot.py
import telepot
import sys
# Connect to our bot
bot = telepot.Bot(token="****bot_botken****")
# Sets the id for the active chat
chat_id=*********
# Sends a message to the chat
bot.sendPhoto(chat_id=chat_id, photo=open(sys.argv[1], 'rb'))
如果我下指令./picture_safe.sh pic.jpg 或 python send_pic_tel_bot.py pic.jpg
telegram跟email都可以收到照片
可是透過motion來做就只有email會收到
請問各位前輩這是哪裡出問題了嗎
謝謝
--
███◣ ██◣ ███◣ ██◣ █◣ ███◣ █◣◥◣ █◣◥◣
████ ███◣ ████ ◥██ ██ ◥███ ██◣█ █
█◣
█
██▆▆ █▉▉▉ ██▆█ ◣ █ ███◣ ◣◢█◤ ████ █
██
█
◥▆▆█ ◥▉◥▉ ◥█ █ ◥██ ◥███ ◥███ ◥█◣█ ◥
██◤ ★
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▃▃▃▃▂▂▂▁▁
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 49.159.186.41
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1503291493.A.C81.html
※ smailzhu:轉錄至看板 Python 08/21 15:49
→ smailzhu: 自問自答:把py的路徑改成絕對路徑就可以了 08/23 02:16
推 dhkvhf: 個人是用Line bot,每2秒掃一次motion儲存的資料夾,當有 08/25 07:25
→ dhkvhf: 新檔案出現就發送最新的圖檔到聊天室 08/25 07:25