Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 04-22-2002, 12:36 PM   #1
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.


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` ]
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


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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:02 AM
file renaming with shell script or ? XJNick Linux - General 5 07-29-2005 03:43 PM
Howto Monitor elapsed time in a shell script rkrijger Linux - Software 2 03-11-2004 09:46 AM
Connection, login and upload files to ftp server via shell script Paulo Ges Linux - Networking 2 02-21-2004 02:01 PM
Search for a file using shell script sharathkv Linux - Newbie 2 08-06-2003 06:05 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:35 PM.

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