Angelos Italianknows Blog

Saturday, 14 April 2012

Getting Apps to autostart on the Looqs Meebox

 

The Looqs Meebox is a typical NAS and one of the things NAS’s do is they refresh their root (/) filesystem on boot, Its a kinda failsafe mechanism I guess… 

Anyway this means if you want too add any startup scripts/edit files etc on boot its a little hard.. However where there’s a will there is a way!

I noticed that although root (/) is in ram /system is mapped to the harddisk, I also noticed there are a number of files which are executed at boot.. One of these is /system/hddapp/etc/rc

Bingo, if you want something to start at boot time, or you need a filesystem modification done at boot (e.g. /opt linked to /mnt/ide/opt) then simply put it at the end of this file.

e.g. The end of my rc file looks like this

#Added stuff by Angelo
#re create /opt link
ln -s /mnt/ide3/opt /opt
# Start TwonkyServer
/mnt/ide3/apps/twonky7.0.5/twonkystarter -appdata /mnt/ide3/apps/twonky7.0.5/two


Enjoy.

10 comments:

  1. Hi Angelo! Thanks for the great articles on the meebox - very useful indeed :)

    Have you started doing anything with Apache on the box yet? I'm interested in adding Mod_mono (http://mono-project.com/Mod_mono) to allow asp.net applications to run, but being a Microsoft developer... I have no idea where to start?! Is this feasible? Would apache support it?

    Any assistance would be great!

    Many thanks and keep up the good work

    ReplyDelete
    Replies
    1. No to be honest I've kinda put the Meebox to one side as I investigate other NAS options.. My main beef with the Meebox is performance , or p**s poor performance.
      Anyway..

      I checked out mod_mono and YES technically it could work on the meebox, with the current distro of apache, BUT you'd need to find a LittleEndian GLib.3.x build of it.. I looked (places like http://www.mono-project.com/Mono:ARM) and I think it exists but maybe only for the nokia Arm7 devices..

      No idea if it would work or not.. Sorry :-(

      Delete
  2. Stunning thanks for all the information. Any chance of a guide on how to get an update on php mysql etc please!!

    ReplyDelete
    Replies
    1. Hi Brogan

      its possible, but I think someone will need to create whats called a "toolchain" to cross-compile the code..

      http://forum.qnap.com/viewtopic.php?p=246316 has done it for the qnap device, but alas I dont have the skills to do it... sorry :-(

      Delete
  3. Help :)
    I'v added a line to the rc file but it never runs. the line added is
    /mnt/ide3/admin/run1
    which sets the path and starts the transmission daemon. I know this works, as when i telnet in and run it the daemon starts just fine.
    What wrong with this???
    Regards
    Gary

    ReplyDelete
    Replies
    1. Could be a number of things..

      Firstly is the script executable? ie have you chmod +x run1
      Also Id simply add the path setting and starting the transmission daemon to the rc file..

      Finally , check the log files in /var/log you might find a hint on whats wrong..
      Finally 2 , can you share the code? I can have a look at it..

      Delete
    2. Hi Angelo,
      here is the batch file contents.

      ln -s /mnt/ide3/opt /opt
      export PATH=/opt/bin:$PATH
      export TRANSMISSION_HOME=/mnt/ide3/transmissionConfig
      /opt/bin/transmission-daemon -w /mnt/ide3/video

      these lines have also been put in the rc file as is and in the batch file but never seam to run. The batch file is executable.

      Regards

      Gary

      Delete
    3. Duh.. no idea, looks as simple as can be.. and mine run..

      try adding redirects to a log file
      e.g.


      /opt/bin/transmission-daemon -w /mnt/ide3/video 2>&1 > /tmp/capture.log

      Then look at /tmp/capture.log

      Im not sure if busybox on the meebox supports the exec function..

      See http://www.linuxquestions.org/questions/linux-general-1/shell-scripting-how-to-redirect-output-from-within-the-script-itself-446558/

      If it does try adding

      exec &> /tmp/captureAll.log

      to the top of the file

      Currently my meebox isin its box awaiting me to decide what to do with it..

      Delete
  4. Hi Angelo

    Thanks very much for the excellent piece on getting Twonky up and running on the meebox.
    I've been wondering if I can use the installed mysql server from a remote client (on a respberry pi). Performance doesn't need to be great so it'll probably be good enough.
    I've added the bind address to the my.cnf file, but when I try to use iptables to enable port access I get an error:

    meebox> /sbin/iptables -I INPUT -i eth0 -s 192.168.1.0/24 -p tcp --destination-port 3306 -j ACCEPT
    iptables v1.3.4: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
    Perhaps iptables or your kernel needs to be upgraded.

    I'm already at the limit of my knowledge and wondering if I should be pursuing this further. Do you have any ideas on where to go on this one. Thanks

    ReplyDelete
  5. Hi there,

    Alas I sold my Meebox earlier this year, and switched to a salvaged O2 Joggler (runs ubuntu).. Alas I dont know linux networking that well.. well not the iptables firewall bits.. but from reading the above it sounds like either iptables isnt installed properly , perhaps they used a custom solution? or something else.. sorry cant help anymore...

    ReplyDelete