motion跟sh跟py還有telegram bot的問題 - Linux

Table of Contents

小弟我在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會收到

請問各位前輩這是哪裡出問題了嗎

謝謝

--
███◣ ██◣ ███◣ ██◣ █◣ ███◣ █◣◥◣ █◣◥◣
███ ██◣ ███ ██ ███
█▆▆ ▉▉▉ █▆█ █◣ ◢█◤ ███
▆▆█ █ █ ██ ███ ███ ██◤
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▃▃▃▃▂▂▂▁▁


--

All Comments

Regina avatarRegina2017-08-21
自問自答:把py的路徑改成絕對路徑就可以了
Anonymous avatarAnonymous2017-08-23
個人是用Line bot,每2秒掃一次motion儲存的資料夾,當有
新檔案出現就發送最新的圖檔到聊天室