![]() |
|
|
google unix.com
|
|||||||
| Forums | Casino | Register | Forum Rules | Links | Albums | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Log file not getting updated | KornFire | High Level Programming | 4 | 10-21-2008 03:12 AM |
| Find last updated file | callimaco0082 | UNIX for Dummies Questions & Answers | 4 | 09-04-2008 10:17 AM |
| checking out latest updated file | asadlone | Shell Programming and Scripting | 3 | 05-08-2008 04:16 AM |
| /etc/utmp file does not get updated with boot up details | jyoti_mil | UNIX for Advanced & Expert Users | 1 | 06-11-2007 10:41 AM |
| Creating an updated file | dbfree | Shell Programming and Scripting | 4 | 09-30-2005 03:23 AM |
![]() |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
If File has been updated, do something??
Put this together from somewhere else on the forums, just modified it and added the loop.
Code:
#!/bin/ksh localFile=$1 remoteFile=$2 #source FTP parameters . .ftp_put.cfg mylog=ftp_session.log echo "$(date "+%H:%M:%S") - Attempt to FTP $1 to $2" > $mylog machine="server1 server2 server3 server4" count=0 # do the FTP put for machine in $machine do ftp -i -n <<EOF >> $mylog open $machine user $FTP_LOGIN $FTP_PASSWORD put $localFile $remoteFile ls $remoteFile quit EOF count=`expr $count + 1` done Code:
/tmp/abcQATest/abcMoveTest.sh archive.tar /tmp/archive.tar Is there any way to set this up so it only ftp's the file if it's been updated since the last time the ftp ran? That way, if it gets updated, it get's FTP'd once, but then it doesn't get FTP'd again unless the file's been changed? Then on the other 4 servers, I also need something like this: Code:
If /tmp/archive.tar has been updated do something . . else endif |
| Sponsored Links |
|
|||
|
Script:
Code:
diff archive.tar backup.tar > tmp if [ -s tmp ]; then /tmp/abcQATest/abcMoveTest.sh archive.tar /tmp/archive.tar echo "Files different, transferring files" else echo "Files the same, exiting"; fi Code:
/tmp/abcQATest>./autoMoveScript.sh Binary files archive.tar and backup.tar differ Files the same, exiting /tmp/abcQATest> Last edited by cbo0485; 11-06-2008 at 04:17 PM.. |
|
|||
|
Quote:
Code:
diff archive.tar backup.tar > tmp if [ -a tmp ]; then /tmp/abcQATest/abcMoveTest.sh archive.tar /tmp/archive.tar echo "Files different, transferring files" cat archive.tar > backup.tar else echo "Files the same, exiting"; fi |
|
|||
|
Here's my final code I got working.
Code:
cmp archive.tar backup.tar > /dev/null if [[ $? -eq 1 ]]; then /tmp/abcQATest/abcMoveTest.sh archive.tar /tmp/archive.tar echo "Files different, transferring files" cat archive.tar > backup.tar else echo "Files the same, exiting"; fi |
|||
| Google The UNIX and Linux Forums |
![]() |
| Bookmarks |
| Tags |
| None |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|