Next, we need a way to fire up the server at boot time. We'll make a new script in the normal location for Unslung startup scripts, /opt/etc/init.d/, and call it S99mediaserver. The S99 indicates that it will be one of the last servers to start up at boot time. Here's the content:
# if the server is already running if [ -n "`pidof mediaserver`" ] ; then
# kill it killall mediaserver 2>/dev/null
# give the server time to shutdown sleep 2 fi
# this is all one line, watch for line wraps! ( cd /share/hdd/data/Media; /share/hdd/data/Media/mediaserver -D >/dev/null 2>&1 )
Then mark it as executable:
chmod +x /opt/etc/init.d/S99mediaserver
Next, we'll need to set up the NSLU2 to share our Media directory so that we can add content. For this we'll use the standard NSLU2 configuration screen accessed through the web interface. Go to the Administration/Advanced/Shares menu to add a new share that will point to our media directory.
In this menu, fill out the Properties section. The important item is Location. Use Disk1 and select the Specify radio button. Fill out the location as "/Media/" and hit the Save as new share button (Figure 2).
Figure 2: Setting up a Media share on the NSLU2
At this point we should have a new network filesystem share that equates to our directory that the media server will use to serve content. Network mount the directory and add some mp3 files, images or video to the appropriate sub folders. If you have any permission errors, consult the NSLU2 documentation to make sure that the appropriate network users have read/write permission.