You are here: Home » Reply » Reply To: Automatically Starting mt-daapd on NSLU2

Reply To: Automatically Starting mt-daapd on NSLU2

#4843
Jxn
Participant

@Sherlock wrote:

@Sherlock wrote:

Once I get it working I will post the code which may help others who follow me.

As stated above, it was very simple once I knew where to look. Since I still have not been able to get the ‘Joe’ editor working, I used the ‘vi’ editor to create a file called ‘rc.local’ in the ‘/share/flash/data/unslung’ directory. In my case running unslung 6.8 and with the USB drive in Drive 2, this diversion script will only be run with the USB drive plugged in.

The actual script was exactly as stated above:

#! /bin/sh
/opt/etc/init.d/S60mt-daapd
return 1

Thanks again to those in the forum who pointed me in the right direction.

If you have time to try, this should work.

Ok, first instructions how linux boots SysV-way 🙂
There is a BSD-way to, but then you don’t have /etc/init.d et al.

Look in /etc/inittab. This files is the first linux looks into when it starts

# The default runlevel.
id:2:initdefault:

This tells you what run level Linux starts with. In this case 2.

So when Linux starts, it runs every program in /etc/rc2.d/ that starts with a ‘S’ in alphabetical order. To make it easy to spot the order, the names has two numbers after the ‘S’. All programs in /etc/rc2.d/ that starts with a ‘K’ is run when you tell Linux to stop (kill). Same with the order of programs run.
When start, the program gets one argument ‘start’ and when stopping one argument ‘stop’.
All programs are not in /etc/rc?.d/-directories though. There are only alias (symbolic links) to right script in /etc/init.d/.

So to manually stop nfs, you usally start with command

/etc/init.d/nfs-common stop

Becouse that script start and stops nfs. Read it to see what else it can do.
So as root, you usally do this to start and stop different services. To make nfs to start when linux start, there is an alias from /etc/init.d/nfs-common to /etc/rc2.d/S21nfs-common (or any usabel number, don use this!)
You can create it with a command like this

ln -s /etc/init.d/nfs-common /etc/rc2.d/S21nfs-common

Don’t do this!!! It usally made byt the package you installed it with.

So, to make mt-daapd start att boot, make this symbolic link (alias)

ln -s /opt/etc/init.d/S60mt-daapd /etc/rc2.d/S60mt-daapd

If you can start and stop daapd with that program/script

When you have started, look in /var/log/messages (and other files in same directory) for messages that say something about daapd. Those log files are important to see what happens when linux starts.

Hope it gives you some help understand how Linux works.[/code][/quote]