Fedora 20 : Launch vlc video at startup - cron

I would like to launch a video with VLC in fedora 20 for atm project.
I already succeed to get the right command line in crontab
#reboot vlc -vvv --loop --fullscreen video_file
but i think vlc is launching & crashing because X server is not totally launched.
Is there an option to make a wait in cron or should i cron a bash script with a timeout before to launch VLC ?

Here is the solution :
( vlc requires an x server to be launched , so you to give it your local x server ip : :0 )
here is the command line :
#reboot DISPLAY=:0 vlc -vvv --loop --fullscreen video_file
and everything is fine

Related

Playing a video on Raspberry Pi OS startup

I need to run a script to play a video when I turn on my Raspberry Pi 4. I'm using crontab to run my script which opens a video with mpv.
When I run the script normally, it works fine and the video is being played.
The problem is, when i boot the raspberry, the script automatically runs but mpv doesn't .
here is my script:
#!/bin/bash
VIDEOPATH="/home/pi/Desktop/my-movie.mkv"
SERVICE="mpv"
while true; do
echo "playing "+$VIDEOPATH
$SERVICE --fs --start=00:00:00 $VIDEOPATH
done
I added this line to crontab:
#reboot /home/pi/Desktop/my-script.sh
I'm totally stuck in this. Any help saves my life!
The most practical solution I found to run GUI programs on startup is using Autostart.
I created a .desktop file at /etc/xdg/autostart directory:
sudo nano /etc/xdg/autostart/display.desktop
when display would be a custom name for my script.
I added following lines the display.desktop :
[Desktop Entry]
Name=Play a video
Exec=mpv --fs --start=00:00:00 path-to-my-video
Saved the file and reboot the Pi.
sudo reboot
As soon as my Pi boots up, my GUI program automatically start as well.
Please update your script:
#!/bin/bash
source ~/.bash_profile
VIDEOPATH="/home/pi/Desktop/my-movie.mkv"
SERVICE="mpv"
while true; do
echo "playing "+$VIDEOPATH
$SERVICE --fs --start=00:00:00 $VIDEOPATH
done

No cursor motion capability occurs when startup linux script execute minicom script with at commands

I have created a startup Linux script for a board that runs Debian jessie Armbian 8.1. I need at startup to run at command in a modem attached to it via USB interface. I've put the script inside rc.local:
#!/bin/sh -e
cd /home/user/Script/
sh script.sh
exit 0
In the folder Script I have a script:
#!/bin/sh
minicom -S at_command.txt
The at_command contains:
send at+creg=1
send exit
! killall minicom
The issue is that when I run the script manually it works correctly,
however when I start the the board the at commands do not execute.
Since the board is Debian I also followed the link: ttp://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html and to adapt the script to run according LSBInitScripts but I got the same behavior. When running sudo /etc/init.d/myScript start manually everything works great, but after Linux startup no at_command is executed. I added in the rc.local the following commands for debugging:
set -x;
exec 2>>/home/user/Script/minicom-rc.log;
date +"$0 %c" >&2
And in the generated log file I got this printout:
+ date +/etc/rc.local %c
/etc/rc.local Fri 02 Mar 2018 04:02:43 PM EET
+ cd /home/user/Script/
+ sh script.sh
No cursor motion capability (cm)
What I have done wrong?
I am guessing it is related to there being no terminal during startup.
Maybe try adding the following line before starting minicom:
export TERM=linux-c-nc
In this scenario you alternatively use my atinout program which is a program specifically made for sending AT commands to a modem from the command line (assuming the modem is /dev/ttyUSB0):
echo at+creg=1 | atinout - /dev/ttyUSB0 -
or possibly
atinout /home/user/at_commands.txt /dev/ttyUSB0 /dev/null

Python selenium script does not open a browser on default display from the crontab

I would like to open a web page in a browser on raspberry by running a python selenium script every n hours from the crontab.
Its a pretty standard script that works if I run it locally on that machine.
So if i connect a keyboard to the raspberry and run
python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
it will open the browser and do the selenium commands that I need.
Now I can also ssh into the raspberry and run
export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
and I can see a browser open and do what I need on the monitor connected to the raspberry.
Now when I add this line to the cron.
57 9 * * * export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt
I can see that cron executed the command if I check grep CRON /var/log/syslog
Jul 18 09:57:01 raspberrypi CRON[2971]: (pi) CMD (export DISPLAY=:0 && python /home/pi/ww/open_dashboard.py >> /home/pi/ww/selenium_output.txt)
But browser did not open on the monitor connected to the raspberry. What could I be doing wrong here? :)

Raspberry Pi bash cvlc internet radio

I want to play internet radio with VLC.
I use cvlc command on terminal and it works.
cvlc http://5.20.223.18/relaxfm128.mp3
But if I create a shell script, radio.sh:
#!/bin/bash
cvlc http://5.20.223.18/relaxfm128.mp3
And I try to run bash script on terminal
bash radio.sh
Then I get multiple errors:
main input error: open of `http://5.20.223.18/relaxfm128.mp3
main input error: Your input can't be opened
VLC is unable to open the MRL 'http://5.20.223.18/relaxfm128.mp3
What I am doing wrong?

Having trouble with rc.local scripting

Hello there Stack Exchange,
I'm trying to use a Raspberry Pi to make a sort of Kiosk display unit out of a TV screen. I figured that this would be a simple enough process, write a startup script that actives LXDE, x11vnc and chromium to the page I want and it's done. But unfortunately, I can't seem to get my rc.local script to work exactly as I want it too and I'm not sure why. This is the code I have added to rc.local
su pi -c startx&
su pi -c x11vnc -display :0 -q -usepw -rfbport 5901
su pi -c chromium --kiosk --incognito "http://www.springwater.ca/"
When the machine is booting it will run the startx command but not the x11vnc or chromium commands. Have I missed something here? Or am I going about this the completely wrong way?
Thanks,
Michael
It will take several seconds before the X server loads and is able to accept connections, but with your &, x11vnc and chromium will try and fail immediately.
After the startx line, you could add a simple sleep 30 to give it time to start, or maybe even poll it:
until xwininfo -root -display :0; do sleep 1; done
i use "nodm" (as package in Debian or from here: http://www.enricozini.org/sw/nodm/) on my Raspberry to login my user and start LXDE. Then autostart all needed applications as described here: http://wiki.lxde.org/en/Autostart.
Edit to answer the comment:
In Debian you can configure the user (and other things) in the file /etc/default/nodm.
I have set the parameter:
# User to autologin for
NODM_USER=dashboard
best wishes,
Matthias

Resources