LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 08-24-2003, 08:19 PM   #1
spyghost
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 245

Rep: Reputation: 30
Question autmatic ftp: from unix to windows


hi,

i am working on a program wherein i have to transfer a continuously changing text file from a unix system (solaris) to windows 2k.

the issue is that: whenever the text files in the unix system is appended/updated, the text file in the windows system must be appended/updated too.

the mode of transfer must be in ftp.

what kind of proramming is needed for this application?
 
Old 08-24-2003, 10:48 PM   #2
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
There are couple of conciderations to be taken, first of all the obvious FTP server on Win32 should be configured and running properly; then you should think about the process of updating the file in *NIX environment - is it done by hand (for isntance, user vi's a file, makes changes and saves the file), or there is a job runnig that updates the file on a triggered event. In the first step I think it is more tedious task, but it is still doable - you need to monitor the file's size and modification time constantly and save the states, once the size or modification time changes you should trigger the ftp step. If the file is updated automatically by otehr programming means than you can trigger ftp step once that job is completed. Be cautious of the fact that if the file is opened in Windows session the ftp might fail, so you probably want to save the file under unique name and then copy or move it to the original filename. Now the techniques of ftp'ing te file - basic ftp command in a shell script, or if you are familiar with perl you can utilize perl's Net::FTP module and its functionality.
Good luck.
If you need any programming assistance post the questions in our Programming Forums.
 
Old 08-25-2003, 08:47 AM   #3
spyghost
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 245

Original Poster
Rep: Reputation: 30
well, in terms of updating, the text files (four text files) are actually a log file from SCADA. there are actually two events that cause the file to be updated. one is the time triggered updating one file is updated every hour and the other every 15 minutes. the other two files are updated at random (these are actually error logs - random in occurence).

is perl the only programming languate which can be used for this?
 
Old 08-25-2003, 06:37 PM   #4
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
No you are not limited perl only, you can use shell programming, c, any other programming language you wish, but I pointed out perl just b/c I am using it extensively; the main purpose of that excersise is to stay with a bare minimum to get the job done, of course you can write an application to do all this but why? Shell programming is sufficient. If the file is updated on a timely manner it is obvious that there is a cron job running, just find out which job is running and modify it as you see fit to include ftp step. For isntance there is a job
a1.sh
running every hour, what a.sh does is monitoring various processes on the system and collects data into a binary file, at the end of the day all the binary files are converted to text based report (by means of a2.sh script) and send out to an administrator (the example is sar on Unices), you can create a script b.sh where the last lines would be ftp'ing the reports and the first directive is to run a2.sh script
Code:
#!/bin/sh
# this is a pseudo-code
/path/to/a2sh > /path/to/rpt.txt
ftp directives to transfer /path/to/rpt.txt to the remote host.
and then you just schedule to run b.sh instead of a2.sh at the end of day.
good luck
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable characters wich are added by the unix system after FTP a file TDABN77 Linux - Newbie 2 12-02-2005 01:54 PM
Linux/UNIX differences with vi and ftp ascii transfers KenMadsen Linux - Newbie 2 06-20-2005 09:51 AM
How is the UNIX ownership of FTP Export assigned? skeetermouse AIX 5 04-20-2005 03:23 PM
Why did you experienced users of Unix change to unix over Windows? Laptop2250 Linux - General 11 10-28-2003 11:51 AM
autmatic ftp: from unix to windows spyghost Programming 11 08-26-2003 11:57 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 04:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration