Allow startup daemons on StorCenter IX2-200 NAS (and other Soho based devices)

Posted by & filed under StorCenter IX2-200 NAS.

It’s useful once you’ve added packages to the StorCenter IX2-200 to have certain daemons start when the device starts up. I know from having a dodgy dishwasher that trips the power on certain cycles (yes I know I should have a UPS :-)) that it becomes annoying pretty fast to have to SSH onto your device to startup SABnzbd+ etc.

What became apparent is that adding services as normal by creating a script in init.d and running update-rc.d doesn’t work and the service is not persistent. From a bit of reading on the web, it seems that the StorCenter overwrites certain volumes at startup.

To set up your own services / daemons, you need to list a script in /mnt/apps/usr/local/cfg/sohoProcs.xml. The problem is that this exists in a read-only partition, so to edit this file, you need to make it writable.

DISCLAIMER!: I’ve run these commands myself with no ill affects, but I take no responsibility if you brick your device. Run at your own risk!

To make the partition writable:
mknod -m0660 /dev/loop3 b 7 3
chown root.disk /dev/loop3
mkdir /tmp/apps
mount -o loop /boot/images/apps /tmp/apps

Make a backup copy of the config:
cp /tmp/apps/usr/local/cfg/sohoProcs.xml /tmp/apps/usr/local/cfg/sohoProcs.xml.bk

Edit the config – I use nano as I’ve installed it using ipkg (yeah, I’m not hardcode šŸ™‚ ), but substitute this for vi or similar if that’s what you use:
nano /tmp/apps/usr/local/cfg/sohoProcs.xml

I replaced the thumbnails program declaration (which was disabled) with a new script I’d added in /opt/etc/init.d/start_init_scripts.sh. I guess you could add your own <Program> declaration if you wanted.

<Program Name="thumbnails" Path="/opt/etc/init.d/start_init_scripts.sh">
<SysOption MaxMem="96M" Nice="15" Restart="-1"/>
</Program>

Unmount:
umount /tmp/apps
rm /dev/loop3

Then it’s a case of making the script do what you need. Mine starts any script in the /opt/etc/init.d/ directory that starts with “S”…
#!/bin/sh

rm /opt/var/log/boot

if [ -d /opt/etc/init.d ]; then
for f in /opt/etc/init.d/S* ; do
#[ -x $f ] && $f start
$f start | tee -a /opt/var/log/boot
done
fi

#this will start the original thumbnails
#/usr/local/thumbnails/thumbnails &

Hope this helps someone.

Cheers

Chris

About Chris Pont


Chris is a UK based Web Developer / Technical Architect with Microsoft Certified Technology Specialist (MCTS) and Microsoft Certified Professional Developer (MCPD) status and 8 years experience with large web applications using .NET, SQL Server and WCF.

8 Responses to “Allow startup daemons on StorCenter IX2-200 NAS (and other Soho based devices)”

  1. FLx

    That’s cool, but how could you solve the problem that the device removes every customization from the root folder including installed packages etc. on every boot? Thanks.

    Reply
  2. Greg

    Hello, Great job ! Really. Both articles has been very usefull for me to install sabnzbd on my ix-2 šŸ˜‰
    However my conf is resetted every each reboot… How have you fixed that behavior please?

    Big thank you.

    Reply
    • Chris Pont

      @Greg

      Thanks!

      I might have written this in the other article, but it took a lot of trial and error to get this working and I was then writing this post install šŸ™‚

      I think I’ve missed out one point. The root partition was nearly full on my NAS when I was doing this and so to allow space I basically moved the /opt folder to a different partition (within the NAS storage space) and symlinked. This gave the root partition more room to do it’s stuff and also persisted the opt folder on reboot.

      Unfortunately I can’t tell you exactly how I did this as my NAS is now configured, but hopefully this points you in the right direction.

      Reply
  3. Joel

    Hello, first congratulations for all articles, I have an IX2-200 and I ventured to install the MySQL server, everything works perfect (I’ll post my results when finished), now I’m trying to add the load with the boot, for that added the following to “sohoProcs.xml” file:

    start

    right.. But I noticed in the mysql log file that the start command is still being called constantly, so the discs do not switch off because the log file is constantly being written.
    Would you describe when you know more information about the options “SysOption” XML?
    Thank you.

    Reply
  4. Joel

    …Program Name=”mysql” Path=”/etc/init.d/mysql”>
    …Args>start…/Args>
    …SysOption MaxMem=”32M” Restart=”-1″/>
    …/Program>

    Reply

Leave a Reply