Ncftp Script Help

Support section for FREESCO v0.3.x 3rd Party Packages

Postby yelsewno » Sat Mar 29, 2008 10:18 am

I'd like to run a script with ncftp but it seems that those features have been removed from the latest releases. (seems strange to me) Anywho I'm currently running a webcam site with an XP box doing my uploads via dialup, and I'm trying to convert the operation over to Freesco. I'm having trouble with my ftp routine and I haven't found any answers with google. (prolly not asking the right questions)

Here is what the windows ftp script currently does..

*username*
*password*
bin
cd /cam1
delete cam1-15.jpg
rename cam1-14.jpg cam1-15.jpg
rename cam1-13.jpg cam1-14.jpg
rename cam1-12.jpg cam1-13.jpg
rename cam1-11.jpg cam1-12.jpg
rename cam1-10.jpg cam1-11.jpg
rename cam1-09.jpg cam1-10.jpg
rename cam1-08.jpg cam1-09.jpg
rename cam1-07.jpg cam1-08.jpg
rename cam1-06.jpg cam1-07.jpg
rename cam1-05.jpg cam1-06.jpg
rename cam1-04.jpg cam1-05.jpg
rename cam1-03.jpg cam1-04.jpg
rename cam1-02.jpg cam1-03.jpg
rename cam1-01.jpg cam1-02.jpg
rename cam1-00.jpg cam1-01.jpg
send cam1c.jpg cam1-00.jpg
bye

It's deleting the oldest and renaming the rest then uploading the new pic. I'm new to ncftp, and the ncftpput command doesn't look like it will get it done. Also batch and spooler are quite cryptic and I'm not sure yet how I will get this to run once an hour.

I know this is a tall order, but any assistance is greatly appreciated. Thanks for your time.

Wes
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA

Postby Lightning » Sat Mar 29, 2008 11:32 am

This operation can easily be done on FREESCO with a small script and a crond job. Here is how to do it.

Code: Select all
cd  /boot/bin
snarf http://lewys-spot.dyndns.org/test/cam1
chmod +x cam1
edit  cam1

You will need to put the "username" and "password" into the last line of the script.
Then run

crontab -e

Add an entry like

0 0/1 * * * cam1 1>/dev/null 2>/dev/null


Then save the entry and it SHOULD rename the files and download a new image once an hour and all of the files are stored on FREESCO at this point in the /www/cam1/ directory for viewing.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby yelsewno » Sat Mar 29, 2008 12:57 pm

Thanks for the reply! That script is great, but what I'm actually trying to do is rename everything on the remote FTP server not the Freesco box. The main reason for doing everything via FTP is the Dial-Up connection. On a shared phone line, I've got to do the renames and uploads in under 2 minutes. Can't really be uploading all the pics everytime. And I can't serve up the images from the Freesco box either, as it is not a constant connection.

Thank you for for introducing me to Snarf! That little tool is awesome! I've been using Links or Lynx to grab the pictures from my network camera, but not anymore.

A side question related to all this, where can I set a system variable so it will be there every time I start up Freesco, for all users. I tried /etc/profile but it doesn't stick in there...

Thanks again!
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA

Postby yelsewno » Sat Mar 29, 2008 5:34 pm

Ok I'm going to start by saying, Snarf rocks! And NCFTP blows. No way to automate renaming remote files with that thing. (not that I can find, please correct me if I'm wrong)

I ended up creating a virtual PC to run Freesco027 on, then copied the old FTP binary off of that system, and put it on my 038 system. Now I can script FTP to my hearts content. I can see how ncftp can be useful for mass uploads and downloads, but it just doesn't suit my purpose.

Thanks again for your input.
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA

Postby Lightning » Sat Mar 29, 2008 6:10 pm

The /etc/profile is the file you want to use to "export" variables for all users. But you MUST copy the file to /boot/etc/ so that the changed script will survive a reboot. Otherwise you will just keep getting the default /etc/profile" script back from the ramdisk which can not be changed on a permanent basis. That statement is almost completely true unless you have the knowledge to rebuild the ramdisk.

Also as you are somewhat new to FREESCO yoiu really should read the commands that are in FREESCO that are included in the main download zip file "commands.htm". You will find there are a LOT of extremely helpful commands. I also strongly recommend installing the "mc" package for managing your entire system.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby yelsewno » Sun Mar 30, 2008 11:28 am

I will do the recommended reading, there are lots of commands I'm unfamiliar with. I've installed the MC package, and I really like the MCEDIT program. I've got my script working now, and am testing my new cron job. Seems to be working good so far.

Thanks again for your time, advice, and patience.
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA

Postby Lightning » Sun Mar 30, 2008 3:24 pm

Now that you have mc installed you SHOULD go into the advanced setup under the "e" extra settings option and change the default editor to "/usr / bin /mcedit" without the spaces as the forum does not like direct links to the bin directory. Then everything you edit with the system will use mcedit.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby yelsewno » Sun Mar 30, 2008 8:59 pm

Ok, I did what I SHOULD.. lol That is a nice editor.

Here is a link to the script I cam up with after copying the old ftp binary over from 027. Let me know what you think.

<a href='http://wdhanson.com/freesco/cvtimg.txt' target='_blank'>My Script</a>

(Forgive me, I'm a DOS batch programmer at heart. But it gets the job done.)
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA

Postby Lightning » Sun Mar 30, 2008 10:39 pm

It looks like a dandy script to me and being a batch file programmer is no crime around here. Hehee everyone starts somewhere which is coming from an old tandy/gw/Q/turbo basic guy.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Lightning
FREESCO GOD !!
 
Posts: 12079
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Postby yelsewno » Mon Mar 31, 2008 7:09 am

First box in the house was TRS-80, that's what I learned a little BASIC on. Good ol' spaghetti code, numbered lines and all. Then we upgraded to the screaming Tandy 1000TL2. I got my first taste of the Internet on the Tandy, with borrowed 1200baud modem. Ah those were the days... Gopher servers, ftp, IRC with decent people to talk to, and NO SPAM... They were simpler times. But I digress, thanks again for your help.. I'm sure I'll be posting more questions in the future.
User avatar
yelsewno
Junior Member
 
Posts: 33
Joined: Sat Mar 29, 2008 10:05 am
Location: Michigan, USA


Return to 3rd Party Package Support for FREESCO v0.3.x

Who is online

Users browsing this forum: No registered users and 4 guests

cron