[问题] motion跟sh跟py还有telegram bot的问题

楼主: smailzhu (嗯嗯)   2017-08-21 12:58:09
小弟我在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会收到
请问各位前辈这是哪里出问题了吗
谢谢
楼主: smailzhu (嗯嗯)   2017-08-23 02:16:00
自问自答:把py的路径改成绝对路径就可以了
作者: dhkvhf (dhkvhf)   2017-08-25 07:25:00
个人是用Line bot,每2秒扫一次motion储存的资料夹,当有新档案出现就发送最新的图档到聊天室

Links booklink

Contact Us: admin [ a t ] ucptt.com