Y installed DietPi (i`m very satisfied whit this OS performance on my raspberry Pi B+ model) whit no video interface (headless). I acces it, by ssh.
I can start and stop vlc web server via terminal commands.
uname -a returns:
dietpi@xxx:~$ uname -a
Linux DietPiServer 4.14.49+ #1120 Wed Jun 13 16:51:11 BST 2018 armv6l GNU/Linux
All is perfect until I disconnect the ssh terminal. The service stop inmediately.
I need a service that start on boot and remains active.
Searching with my friend google, i found systemd process to create custom services. I`m trying to learn this method, because rc.local in this version is deprecated (or not recommenden at least).
I created the following files:
Code: Select all
/etc/vlc/start.sh
Code: Select all
#!/bin/sh
echo "Starting WEB Interface for VLC...."
sudo -u dietpi vlc -I http --http-password 123
This file have execution privileges.
Code: Select all
/etc/systemd/system/vlc.service
Code: Select all
[Unit]
Description=VLC WEB Interface Service
After=network.target
[Service]
Type=forking
ExecStart=/etc/vlc/start.sh
Restart=on-abort
[Install]
WantedBy=multi-user.target
Code: Select all
dietpi@xxx:/etc/systemd/system$ sudo /etc/vlc/start.sh
Starting WEB Interface for VLC....
VLC media player 2.2.6 Umbrella (revision 2.2.6-0-g1aae78981c)
[00616e68] pulse audio output error: PulseAudio server connection failure: Connection refused
[00636c48] core interface error: no suitable interface module
[0057a918] core libvlc error: interface "globalhotkeys,none" initialization failed
[00636cb0] dbus interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[00636cb0] core interface error: no suitable interface module
[0057a918] core libvlc error: interface "dbus,none" initialization failed
[00636cb0] [http] lua interface: Lua HTTP interface
The terminal is locked until I press Ctrl+C. At this point the Interface gets down.
Now, when I execute:
Code: Select all
sudo systemd start vlc.service
Code: Select all
dietpi@xxx:/etc/systemd/system$ sudo systemctl start vlc.service
Job for vlc.service failed because a timeout was exceeded.
See "systemctl status vlc.service" and "journalctl -xe" for details.
Code: Select all
dietpi@xxx:/etc/systemd/system$ sudo systemctl status vlc.service
● vlc.service - VLC WEB Interface Service
Loaded: loaded (/etc/systemd/system/vlc.service; disabled; vendor preset: enabled)
Active: failed (Result: timeout) since Mon 2018-06-18 21:40:35 -03; 1min 34s ago
Process: 2980 ExecStart=/etc/vlc/start.sh (code=killed, signal=TERM)
CGroup: /system.slice/vlc.service
jun 18 21:39:06 xxx start.sh[2980]: [00e15918] core libvlc error: interface "globalhotkeys,none" initia
lization failed
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] dbus interface error: Failed to connect to the D-Bus ses
sion daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] core interface error: no suitable interface module
jun 18 21:39:06 xxx start.sh[2980]: [00e15918] core libvlc error: interface "dbus,none" initialization
failed
jun 18 21:39:06 xxx start.sh[2980]: [00ed1cb0] [http] lua interface: Lua HTTP interface
jun 18 21:40:35 xxx systemd[1]: vlc.service: Start operation timed out. Terminating.
jun 18 21:40:35 xxx systemd[1]: [color=#FF0080]Failed to start VLC WEB Interface Service.[/color]
jun 18 21:40:35 xxx systemd[1]: vlc.service: Unit entered failed state.
jun 18 21:40:35 xxx systemd[1]: vlc.service: Failed with result 'timeout'.
jun 18 21:40:36 xxx sudo[2981]: pam_unix(sudo:session): session closed for user dietpi
dietpi@xxx :/etc/systemd/system$
Thankyou in advance.
Mirko