![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| server monitor script... | zedex | Shell Programming and Scripting | 1 | 06-01-2008 05:10 PM |
| need help doing a script to monitor if files are go through | jonathan184 | Shell Programming and Scripting | 0 | 05-15-2007 12:47 PM |
| load monitor script | locabuilt | UNIX for Advanced & Expert Users | 7 | 01-19-2007 02:37 PM |
| Script to Monitor databases help with arrays | nelmest | Shell Programming and Scripting | 1 | 09-05-2005 11:50 PM |
| Monitor which users enter my home directory | mnpradeep | High Level Programming | 1 | 03-21-2002 05:08 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hep with script to monitor directory
Hello,
I am a newbie who is attempting to write a script to monitor a directory for a set of 3 files that I am expecting to get ftp’d. Occasionally, we suspend operations for maintenance etc. but we still get the files so there can be more than 1 set. If there is more than 1 set, I would like to move all but the latest set to an archive directory. For example say the files are named: acme1_090106.txt acme1_091006.txt acme1_092206.txt acme2_090106.txt acme2_091006.txt acme2_092206.txt acme3_090106.txt acme3_091006.txt acme3_092206.txt I would like to move the older files to an archive directory acme1_090106.txt acme1_091006.txt acme2_090106.txt acme2_091006.txt acme3_090106.txt acme3_091006.txt I am running AIX version 5.31. This is what I have so far. Any suggestions would be deeply appreciated. #!/bin/ksh # files=0 LoopCnt=0 while (( $files < 4 )); do echo `date` for name in `ls acme*`; do if [ -f $name ] then let files=files+1 fi done if (( $files < 3 )); then if ((LoopCnt < 6)); then echo "do not have 3 files yet, sleeping 10 minutes" echo "" sleep 600 files=0 let LoopCnt=LoopCnt+1 else exit fi fi done This is where I'm stuck if (( $files > 3)); then echo "Have more than 3 files, move all but the latest to archive” exit fi |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|