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?
Related
I'm using Linux (Mint 20.3) to run a simple Minecraft server and I want to be able to start the server with a keyboard or desktop shortcut. I also want to be able to interact with the server in a terminal after it starts. I'm currently using the server software supplied by Mojang. I wrote a little program to get things started:
#!/bin/bash
cd /home/trevor/Minecraft_Server
LD_LIBRARY_PATH=. ./bedrock_server
exec $SHELL
I can get the server to run but I have no clue how to get it to open a terminal window so I can interact with the server. I'm relatively new to Linux so any input would be greatly appreciated.
you can use screen to detach and attach to run commands into the minecraft terminal.
to install screen:
apt-get install -y screen
To launch, update your script with something like:
screen -S mcs ./bedrock_server
to reattach, run the following in a terminal:
screen -r mcs
Use screen in your script to reattach to bedrock process.
Install screen:
apt-get install screen
Define your script as:
#!/bin/bash
export LD_LIBRARY_PATH=.
cd /home/trevor/Minecraft_Server
screen -d -m -S bedrock ./bedrock_server
After invoke your script, screen creates a socket that can be used to reattach to your script terminal. You can show screen sockets available with:
screen -ls
Parameter -S defined 'bedrock' as the socket name. So you can open another terminal as you like and reattach to the bedrock process with:
screen -r bedrock
If you detach the screen with CTRL+C the screen will be closed and so the minecraft bedrock server. To deattach without close the process you must use CTRL+A and CTRL+D.
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
I have been trying to automate the setup process for pi hole on a raspberry pi. I am relatively new to bash and am unable to figure out how to automate the setup process once the terminal gui for the program begins.
this is what I have so far
#!/bin/bash
pihole -r
echo "waited"
$SHELL
So I reiterate back to my question, how do I automate the task of choosing and entering the option in the terminal gui of the pihole program? Any help would be greatly appreciated.
There's already a script that should be able to do it for you ("Pi-hole Automated Install")
To execute it you'd do:
curl -L install.pi-hole.net | bash
unfortunately it's too big to post here, so you'll want to grab it
here:
↳ Github : Pi-hole Automated Install
I'm pretty new to Linux / Raspberry PI.
I want to run a command from a shell script in a new shell window since commands like "cvlc music.mp3" (VLC PLAYER) would block the shell until playback has beenn finished.
Therefore it would be nice to export the playback command to another shell
Is this correct?
gnome-terminal && lxterminal don't seem to be an option for the distribution
for testing purpose I created two dumnmy shell-scripts:
[start.sh]
#!/bin/sh
lxterminal\
--title="MyScriptWindow" \
-e "bash -c ./exe.sh;bash"\
[exe.sh]
#!/bin/sh
echo "Hello World"
[output]
root#raspberrypi:/home/pi# ./start.sh
(lxterminal:1315): Gtk-WARNING **: cannot open display:
If I've understood correctly, you are doing all this only because you want the shell to be released at the execution of your cvlc.
You only need to detach it from shell standard output and run it as a background process
nohup cvlc music.mp3 &
is this enought ?
You could also run the program in background
$> ./test.sh &
Or use screen
Using these command you wont block your shell.
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