Add VLC player to run at start up

Add VLC player to run at start up

sudo nano /etc/init.d/vlc

Copy and paste the following code in the editor

# vlc autostart created by Nanda
export USER='pi'

eval cd ~$USER

# Check the state of the command - this'll either be start or stop
case "$1" in
start)
# if it's start, then start vlc using the details below
su $USER -c '/usr/bin/vlc --extraintf http
echo "Starting vlc for $USER "
;;
stop)
# if it's stop, then just kill the process
pkill Xvlc
echo "vlc stopped"
;;
*)
echo "Usage: /etc/init.d/vlc{start|stop}"
exit 1
;;
esac
exit 0

Set file properties
Once that’s done make sure the file has the right propertied by typing the following:

sudo chmod 755 /etc/init.d/vlc

NOTE: Important to do this step every time you modify this file. I redid these steps to create the tutorial, skipped this step and couldn’t VLC in on the reboot!

Add File to startup sequence
And now just add your file to the list of startup actions by typing the following:

sudo update-rc.d vlc defaults

And that should be it! Just restart, and you should be able to VLC straight in!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s