LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-22-2002, 11:36 AM   #1
noodle123
LQ Newbie
 
Registered: Apr 2002
Posts: 27

Rep: Reputation: 15
Shell File Upload Monitor Script


Purpose of Script:

Clients will upload files on a daily basis to the server. When the file is finished uploading. The script will move the file to a different location and rename it, leaving the upload directory always empty.

Problem:

How do I use shell commands/operators to know when the file has finished uploading. Everytime i do a listing the file size will increment so i know i could do a script to do a dir listing every say 5-10 secs to continuosly monitor the file size. However do to a slow down in the internet, the transmission may be slow and not increment for sometime and then begin again. Is there a way to monitor this and when it's done move/rename the file?

This is the script so far.

ls -l ${SPATH}EigenA.????????.????.dat.compress | awk '{print $5}' > .listn1
echo "`date '+%D %T'` File Upload In Progress..." >> .sympalog

sleep 5

ls -l ${SPATH}EigenA.????????.????.dat.compress | awk '{print $5}' > .listn


while [ `cat .listn1` != `cat .listn` ]
do
sleep 3
ls -l ${SPATH}EigenA.????????.????.dat.compress | awk '{print $5}' > .listn1
echo "`date '+%D %T'` `cat .listn`" >> .sympalog
sleep 10
ls -l ${SPATH}EigenA.????????.????.dat.compress | awk '{print $5}' > .listn
echo "`date '+%D %T'` `cat .listn1`" >> .sympalog
done

********

All in all, is there another more professional/accurate way to go about this?
 
  


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
cannot execute script file from shell shahrahulb Linux - General 4 03-04-2008 07:02 AM
file renaming with shell script or ? XJNick Linux - General 5 07-29-2005 02:43 PM
Howto Monitor elapsed time in a shell script rkrijger Linux - Software 2 03-11-2004 08:46 AM
Connection, login and upload files to ftp server via shell script Paulo Góes Linux - Networking 2 02-21-2004 01:01 PM
Search for a file using shell script sharathkv Linux - Newbie 2 08-06-2003 05:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:10 PM.

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