LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-17-2014, 07:23 AM   #1
coxs
LQ Newbie
 
Registered: Jan 2014
Posts: 1

Rep: Reputation: Disabled
Question How do i open a specific file on startup?


Hi i have a raspberry pi running debian. I have it connected to an old radio so that i can listen to my favourite web radio station automatically on it. However when i reboot the pi i have to use putty to access a remote terminal and type in the following commands to get it working again:

1) screen
2) vlc /home/pi/listen.pls disown

this gets the radio station playing. I tried to create a bash startup script to get this vl;c playlist to work on startup, i was able to get vlc to open but not to play the playlist.

It is driving me mad does anyone know how i can get this automated so if the pi goes down it automatically starts playing on reboot.

Thanks.
 
Old 01-17-2014, 07:58 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Please post the script you have using [code] blocks.

However a suggestion is that you create a script in /etc/init.d and create symbolic links to it in /etc/rc#.d. Do you understand that convention for starters? Which is how to create a startup script?

The script itself may be as simple as the following:

Code:
#!/bin/sh
# Automatically start up VLC to play my favorite radio station

screen;
vlc /home/pi/listen.pls disown;
A recommendation is to find the path for each of those commands; on my system they are:

Code:
/usr/bin/screen
/usr/bin/vlc
Therefore your script would contain the correct paths:

Code:
#!/bin/sh
# Automatically start up VLC to play my favorite radio station

/usr/bin/screen;
/usr/bin/vlc /home/pi/listen.pls disown;
Here are some tips on bash scripting to debug the script: Bash Script Tips

And here is a suggestion to quickly get the script running at startup:
  1. Put the script into /etc/init.d
  2. Create symbolic links in /etc/rc2.d, /etc/rc3.d, /etc/rc4.d, and /etc/rc5.d to point to your script; i.e. ln -s ../init.d/<script-name> S99<some-name> and note you'll probably have to do this as root or use sudo
 
1 members found this post helpful.
Old 01-18-2014, 08:50 AM   #3
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
for the system to do it automatically, i would put it in /etc/rc.local.
for the user to do it once logged in you can put it in ~/.bash_profile.
some newer distros support a @reboot directive in the users crontab.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget, download specific links into specific file names Si14 Linux - Software 1 04-30-2013 01:42 AM
[SOLVED] Link to open File Browser in specific directory AlexFr Red Hat 1 07-05-2012 06:39 AM
New open file size limit is getting reflected in the specific user srajeshkumar Linux - Server 6 05-18-2011 08:32 AM
Samba: Cannot open Credentials file on startup paul.nel Linux - Networking 2 11-23-2004 12:06 PM
how to make a file that will open specific things for you zexter Programming 2 11-06-2004 07:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration