Vlc startup script

*nix specific usage questions
mulja
New Cone
New Cone
Posts: 2
Joined: 14 Sep 2012 15:30

Vlc startup script

Postby mulja » 14 Sep 2012 15:40

Hi
how to made start up script after reboot on my ubuntu server
what i am done

sudo touch /etc/init.d/vlc

#!/bin/sh

echo "`date`;Reloaded" >> /home/mulja/vlc.log

#
killall -9 vlc

sleep 2

if [ $1 ]
then
SOURCE=$1
else
SOURCE=/home/mulja/vlm.conf
fi

vlc -vvv --ttl 12 -I telnet --http-reconnect --http-caching=10000 --vlm-conf vlm.conf

sudo update-rc.d vlc defaults

sudo chmod +x /etc/init.d/vlc

what i am doing wrong

billx
New Cone
New Cone
Posts: 3
Joined: 15 Sep 2012 12:01

Re: Vlc startup script

Postby billx » 15 Sep 2012 12:35

Hi,

First, the command "sudo update-rc.d vlc defaults" need to know what are the defaults settings.
Add this to your file :

Code: Select all

### BEGIN INIT INFO # Provides: vlc # Required-Start: # Required-Stop: # Should-Start: $network # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VLC # Description: VLC daemon with HTTP interface. ### END INIT INFO
Then you will have problems starting vlc as root. Use vlc_wrapper instead.

If you want, you can use this template to run the vlc daemon properly :

Code: Select all

#!/bin/sh ### BEGIN INIT INFO # Provides: vlcd # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $network # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VLC daemon # Description: VLC daemon with HTTP interface. ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON_BIN=/usr/bin/vlc NAME=vlcd DESC="VLC daemon" PIDFILE=/tmp/vlcd.pid [ -x "$DAEMON_BIN" ] || exit 0 DAEMON_OPTS="//// Your option here /////" USER="///// Your user name ////" . /lib/lsb/init-functions case "$1" in start) export DISPLAY=:0.0 log_daemon_msg "Starting $DESC" "$NAME" start-stop-daemon --start --oknodo --quiet --chuid $USER --exec "$DAEMON_BIN" \ --pidfile "$PIDFILE" -- $DAEMON_OPTS > /dev/null 2>&1 log_end_msg "$?" ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --oknodo --quiet --exec "$DAEMON_BIN" \ --pidfile "$PIDFILE" log_end_msg "$?" ;; restart) $0 stop sleep 8 $0 start ;; status) status_of_proc "$DAEMON_BIN" "$NAME" -p "$PIDFILE" exit $? ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|status}" >&2 exit 1 ;; esac exit 0
You have to change DAEMON_OPTS and USER.

You may have to change the line (if you don't need videos, don't worry about that)
export DISPLAY=:0.0
(Run "echo $DISPLAY" in a terminal to what should be after =)

mulja
New Cone
New Cone
Posts: 2
Joined: 14 Sep 2012 15:30

Re: Vlc startup script

Postby mulja » 16 Sep 2012 16:29

Thanks for answer
what i have to write in
DAEMON_OPTS
i just want what vlc start after reboot
and run my vlm.conf file
vlc -vvv --ttl 12 -I telnet --http-reconnect --http-caching=10000 --vlm-conf vlm.conf

billx
New Cone
New Cone
Posts: 3
Joined: 15 Sep 2012 12:01

Re: Vlc startup script

Postby billx » 17 Sep 2012 21:39

This should work :

Code: Select all

#!/bin/sh ### BEGIN INIT INFO # Provides: vlc # Required-Start: # Required-Stop: # Should-Start: $network # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VLC # Description: VLC ### END INIT INFO echo "`date`;Reloaded" >> /home/mulja/vlc.log # If it's a reboot, you probably don't need this !?! # killall -9 vlc # sleep 2 # if [ $1 ] # then # SOURCE=$1 # else # SOURCE=/home/mulja/vlm.conf # fi /usr/bin/vlc-wrapper -vvv --ttl 12 -I telnet --http-reconnect --http-caching=10000 --vlm-conf vlm.conf
You should use the absolute path to vlm.conf.
Your if loop is not useful here, I guess you plan to use it.

Then run the same 2 lines :
sudo update-rc.d vlc defaults

sudo chmod +x /etc/init.d/vlc

hurr1c4n
New Cone
New Cone
Posts: 2
Joined: 08 Apr 2013 16:35

Re: Vlc startup script

Postby hurr1c4n » 19 Apr 2013 14:50

Hi there!

I know that this thread is really old but I have a question about my startup script.

My script is something like this:

Code: Select all

#!/bin/sh ### BEGIN INIT INFO # Provides: vlcd # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $network # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VLC daemon # Description: VLC daemon with HTTP interface. ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON_BIN=/usr/bin/vlc-wrapper NAME=vlcd DESC="VLC daemon" PIDFILE=/tmp/vlcd.pid [ -x "$DAEMON_BIN" ] || exit 0 DAEMON_OPTS="--ttl 10 --vlm-conf /vlc/zdf-dlf.vlm" USER="user" . /lib/lsb/init-functions case "$1" in start) export DISPLAY=:0.0 log_daemon_msg "Starting $DESC" "$NAME" start-stop-daemon --start --background --oknodo --quiet --chuid "$USER" --make-pidfile --pidfile "$PIDFILE" --exec "$DAEMON_BIN" -- $DAEMON_OPTS > /dev/null 2>&1 log_end_msg "$?" ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --oknodo --quiet --pidfile "$PIDFILE" log_end_msg "$?" ;; restart) $0 stop sleep 8 $0 start ;; status) status_of_proc "$DAEMON_BIN" "$NAME" -p "$PIDFILE" exit $? ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|status}" >&2 exit 1 ;; esac exit 0
This script works fine if I am already logged in. As the user I want run with or with user root.

I also made a symbol link in /etc/rc2.d to the init.d script.

Code: Select all

S20vlc -> ../init.d/vlc
My problem is, that everytime the server starts the script runs and the vlc-wrapper would be started. But the stream doesn't work. If I stop the deamon manually and start it on the commandline again, everything is working fine.

Have anyone an idea where my problem is located?

Kind regards,
Thomas


Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 28 guests