I have the following situation:
There is a Windows folder that was installed on the Linux machine. There may be several folders (setting before hand) in this Windows mount. I have to do something (preferably a script to start with) to look at these folders.
These are the following steps: Keep track of any incoming files. Make sure they are fully transferred. Move it to another folder. I have no control over the file transfer program on a Windows machine. I believe this is secure FTP. Therefore, I cannot ask this process to send me a trailer file to ensure the completion of the file transfer.
I wrote a bash script. I would like to know about any potential obstacles with this approach. The reason is, there is the possibility of multi-sheeted copies of this script for multiple directories like this.
At the moment, there may be up to 100 directories that may need to be tracked.
The following is a list of script. I apologize for inserting a very long one here. Do not waste time browsing and commenting / criticizing. :-)
3 parameters are required: the folder that should be viewed, the folder into which the file should be moved, and the time interval, which was explained below.
Sorry, there seems to be a problem with alignment. Markdown doesn't seem to like it. I tried to organize it correctly, but could not do it.
Linux servername 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
#!/bin/bash log_this() { message="$1" now=`date "+%D-%T"` echo $$": "$now ": " $message } usage() { cat << EOF Usage: $0 <Directory to be watched> <Directory to transfer> <time interval> Time interval is the amount of time after which the modification time of a file will be monitored. EOF `exit 1` } if [ $# -lt 2 ] then usage fi WATCH_DIR=$1 APP_DIR=$2 if [ ! -d "$WATCH_DIR" ] then log_this "FATAL: WATCH_DIR, $WATCH_DIR does not exist. Exiting" exit 1 fi if [ ! -d "$APP_DIR" ] then log_this "APP_DIR: $APP_DIR does not exist. Exiting" exit 1 fi
source share