VLC autostart

I'm trying to set up a new media box. The box will run headless and the idea is to have it auto start VLC. I had this running in Linux but since this is my first time using FreeBSD I am getting pretty confused.

I installed VLC ok from the ports collection. I can run it as my own user and it seems to work. Trying to get it to run on startup though is giving me headaches.

I set up a script for it:

/usr/local/etc/rc.d/acvlc
Code:
#!/bin/sh

# PROVIDE: acvlc

. /etc/rc.subr

name="acvlc"
rcvar=`set_rcvar`
start_cmd="acvlc_start"
stop_cmd=":"

load_rc_config $name

acvlc_start()
{
    if checkyesno ${rcvar}; then
      nohup sudo -u aidan /usr/local/bin/vlc -I http &
    fi
}

run_rc_command "$1"

and added this line to the /etc/rc.conf file:
Code:
acvlc_enable="YES"

If I run the command as root [cmd=]/usr/local/etc/rc.d/acvlc start[/cmd], it starts up and runs in the background. (It is running with the root user's env settings, but at least it starts.)

Any hints as to what I'm doing wrong? I don't know to how to get any debug logs either so it's a bit of a mystery. :(

All I want to do is run vlc on boot as a non root user... I'm open to any better ways of doing it.

Thanks,
Aidan
 
I managed to resolve this issue, it was being caused by trying to use sudo. The correct command was:
nohup su - aidan -c '/usr/local/bin/vlc -I http' &
 
Back
Top