NSLU2-Linux
view · edit · print · history

New information that makes the whole communicating from a PC thru the SLUG to the Toppy a lot less painful, puppycron is now redundant.

Thanks to the good work started by Peter with puppy, and now MSteveB? with lib-topfield and now ftp-topfield, we now have ftpd-topfield, a far far simpler way of transferring files to/from the Toppy than with commandline etc. If you have a SLUG, simply

  ipkg update
  ipkg install ftpd-topfield

This installs an ftp daemon (you will have to remove the script that initiates the normal ftpd above, and kill the normal ftpd process) that allows communication with the toppy using anonymous FTP.

So now you no longer have to setup all the directories and transfer points to get TED/TEDS working to the Toppy either.

And, not only this, you can now run a FTP client with GUI on your remote machine (PC/whatever), access the IP address of the SLUG, and have a nice FTP drag&drop gui access of the Toppy filesystem, which is far better than Altair!

Things to be careful of:

Don't have any keepalives setup for your client, as if the client attempts to communicate via the slug when the Toppy is powered down (or rebooting), you end up with a 2nd ftpd-topfield process which hangs up ftp communications until you kill it off in the slug (probably more with rebooting than with powered down). If this happens, telnet/SSH into the slug and type:

  ps -ef

and look for the second ftpd-topfield process. It should be proceded by a number, simply type:

  kill number

and this will get ftpd-topfield working properly again.

If you have an FTP client session open with the Topfield and, say, run TED/TEDS, TED/TEDS will hang up until you close the FTP client session. This is due to the single threaded connection to the Toppy.

I am using the "SmartFTP?" client, version 1.5 has a small problem (well, ftpd-topfield is reporting unix but then sending "\" pathnames, triggering the issue) that the SmartFTP? Author has fixed just for me ;-), new download here: http://www.smartftp.com/get/SFTPDev.exe(approve sites)


The ipkg "ftpd-topfield" makes all the below redundant now, (keeping this info here for historical purposes).

I use this script I called "puppycron" to copy tgd files to the Topfield that have been ftp uploaded by "TED" or "TEDS" (it also gets the log and tsv out the toppy too). So you will also need to download an ftpd to allow the ftp to operate.

http://www.nslu2-linux.org/wiki/HowTo/SetupFtpd

Add this line to /etc/inetd.conf

 ftp stream tcp nowait root /bin/ftpd ftpd

I maybe found a mistake in the above, with an unslung SLUG, the file to edit is actually /opt/etc/inetd.conf

Try /opt/etc/inetd.conf, if this gives probs, then try /etc/inetd.conf... (it gets very confusing, as some stuff in the default locations is only valid as the SLUG is booting, then the unslung directories like /opt/foo (foo=whatever including bin,etc,lib etcetc) appear to be valid at some point after boot.

or I have seen this method documented in one or two wiki's- you could put a diversion script in /unslung called rc.xinetd and put the following lines in:

 #!/bin/sh
 if ( [ ! -f /etc/inetd.conf ] || !(grep ftpd /etc/inetd.conf -q) ) then
       echo "ftp stream tcp nowait root /bin/ftpd ftpd" >> /etc/inetd.conf
 fi
 return 1

Edit your /etc/passwd file to ensure the anonymous ftp user is allowed access to the correct directory:

 ftp:x:14:50:FTP User:/share/hdd/data/topfield:

Create the puppycron script, and put it into /opt/bin (also, you should chmod +x the file to make it executable)

  #!/bin/sh
  cd /share/hdd/data/topfield/EPG
  if ps | grep -v grep | grep -q "puppy "; then
  else
   if /opt/bin/puppy -qc cancel; then
    for i in *.tgd
    do echo $i ;
      if test -e $i ; then
       /opt/bin/puppy -qc cancel ; /opt/bin/puppy -qc cancel ; /opt/bin/puppy -qc put $i \\EPG\\$i
       rm $i
      fi
    done
    sleep 5
    if /opt/bin/puppy -qc dir EPG |grep -q epg_timers.tsv ; then
     /opt/bin/puppy -qc get 'EPG\epg_timers.tsv' epg_timers.tsv
     chmod 777 epg_timers.tsv
    fi
    if /opt/bin/puppy -qc dir EPG |grep -q epg_upload.log ; then
     /opt/bin/puppy -qc get 'EPG\epg_upload.log' epg_upload.log
    chmod 777 epg_upload.log
    fi
   fi
  fi

Edit your /etc/crontab file so the script can occur regularly:

  SHELL=/bin/sh
  PATH=/sbin:/bin:/usr/sbin:/usr/bin
  MAILTO=""
  HOME=/
  # ---------- ---------- Default is Empty ---------- ---------- #
  0 0-23/8 * * * root /usr/sbin/CheckDiskFull? &>/dev/null
  0 0 * * * root /usr/sbin/WatchDog? &>/dev/null
  1 * * * * root /usr/sbin/hwclock -s &>/dev/null
  0-55/5 * * * * root /opt/bin/puppycron &>/dev/null 

(will launch puppycron every 5 mins, will therefore every 5mins look for new files to upload, and download the tsv/log file)

Create your EPG etc directories off the /share/hdd/data/topfield directory and make sure they have permissions for the ftp user to read and write to them. And enjoy the TED/TEDS connectivity and features that windows users have, all via the SLUG running puppy to get long distance access to your Topfield (with TED/TEDs running on a remote windows PC which will ftp into the slug, if you setup TED/TEDS according).


Cheers

Tony

view · edit · print · history · Last edited by tonymy01.
Based on work by tonymy01.
Originally by peteru.
Page last modified on May 18, 2006, at 07:49 AM