Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4485

Troubleshooting • Cronjob does not run launcher.sh

$
0
0
Goodday,

I want to Run a script after a reboot;

The Pythonscript that I want to run called test.py:

Code:

import osos.system("ffplay -i home/pi/dir/anything.mp4 -loop 0 -fs")

The launcher script:

Code:

#!/bin/sh# launcher.sh# navigate to home directory, then to this directory, then execute python script, then back homecd /cd /home/pi/dirsudo python3 test.pycd /

And at last the crontab code:

Code:

@reboot sh /home/pi/dir/launcher.sh >/home/pi/logs/cronlog 2>&1

The problem is that after a reboot it shows a flash of the mp4, and then the screen goes black.
The cronlog gives an error as below:

*error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Input #0, mpeg, from 'home/pi/dir/anything.mp4':f=0/0
Duration: 00:00:14.02, start: 0.300300, bitrate: 6426 kb/s
Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, progressive), 720x480 [SAR 32:27 DAR 16:9], 6000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn
Side data:
cpb: bitrate max/min/avg: 6000000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 320 kb/s
1.01 A-V: 0.016 fd= 5 aq= 40KB vq= 992KB sq= 0B f=0/0*

What is wrong? Do I have to at some timestamp in the baby.py script?

I tried to change the video in a .vob instead of the mp4. But the result is the same.

When I run the script in a terminal : python3 home/pi/dir/baby.py, it works like it should.
When I run the sh launcher.sh command : the video plays, but there's no sound to it...

Statistics: Posted by Wessiez — Sun Nov 03, 2024 3:43 pm — Replies 1 — Views 23



Viewing all articles
Browse latest Browse all 4485

Trending Articles