Motion - Support Question 2015x 12x 09x 034630

Fail to call bash file from motion.conf


Hi, I'been working on a project to configure my Raspberry Pi, Motion and Telegram. The idea is to send a message to Telegram on my Android when an event is detected by Motion. Based on some tutorials available what I need to do is just to create a bash file (.sh) that will invoke Telegram and send message, and this bash file is called at on_event_start in motion.conf.

However the bash file that I've created is not called by om_event_start. Does anyone have any suggestion on how to solve this?

Now, I hace successfully installed Motion and Teklegram, and both are running perfectly. I can send message using Telegram on my raspberry to another Telegram user on Android. The, I created a bash file named as follows:

  cd ${tgpath}
  (echo "safe_quit") | ${tgpath}/bin/telegram-cli -k -U root -W -e "msg xxxx Motion detected in FF6";

I have change the owner of the bash file to motion and also have done chmod 755:

pi@raspberrypi-ff6 /etc/motion $ ls -l
total 52
-rwxrwxrwx 1 root motion    59 Dec  9 03:34
-rw-r----- 1 root motion 28410 Dec  9 10:34 motion.conf
-rw-r--r-- 1 root root     494 Dec  4 17:44 motion-old2.conf
drwxr-xr-x 2 root root    4096 Dec  9 03:42 new
-rwxrwxrwx 1 root motion   114 Dec  9 08:28
-rw-r--r-- 1 root root     427 Dec  9 08:03
-rwxrwxrwx 1 root motion   162 Dec  9 01:56

I can execute from terminal using this command:

pi@raspberrypi-ff6 /etc/motion $ ./ 
Telegram-cli version 1.3.3, Copyright (C) 2013-2015 Vitaly Valtman
Telegram-cli comes with ABSOLUTELY NO WARRANTY; for details type `show_license'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show_license' for details.
Telegram-cli uses libtgl version 2.0.3
Telegram-cli includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit. (
Telegram-cli uses libpython version 3.4.2
I: config dir=[/home/pi/.config/telegram-cli]
> safe_quit
[11:10]  xxxx <<< Motion detected in FF6
> > All done. Exit
pi@raspberrypi-ff6 /etc/motion $ 

And it will send the message to xxxx. However when I put the command in motion.conf:

on_event_start ./

Nothing happens. 


Motion version: 3.2.12
ffmpeg version:  
Libraries: ffmpeg, mysql, postgresql
Server OS:  
-- HaryaWidiputra - 09 Dec 2015


Try an absolute path in your motion.conf

So instead of:

on_event_start ./

it should be:

on_event_start /home/pi/

If that does not work, try creating a simple shell script to call from motion.conf, that could write to a file, to make sure motion is actually calling your script.


I have the same problem

My bash file (.sh) sends a video through telegram-cli.

It works nicely when I execute the bash file from the shell.

Then, I wanted motion to execute the script as soon as it finishes to record a video (adding a calling line on_movie_end tag in motion.conf), but it does not work.

I included an absolute path for the script, but still it is not working.

I've checked that motion actually calls the scrpt because the process appears after executing a ps command. Therefore, it seems that somewhat telegram-cli does not work properly when called this way.

Any idea?

Many thanks
Topic revision: r3 - 17 Dec 2015, JuanPita
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.