Results 1 to 4 of 4
hi folks.
first of all, sorry about my poor english, i'm from brasil.
i have some really important data to send from one server to another, so i have done ...
- 01-19-2009 #1Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
du giving different values
hi folks.
first of all, sorry about my poor english, i'm from brasil.
i have some really important data to send from one server to another, so i have done a little bash script that send the data through scp from 20h until 8h am.
my issue is that this data is really really important, and i can't afford to lose anything, so i have done a little check in the and of each directory transfer to check if the directory sizes are the same, so i can safely remove the data from the source server. i want to use bytes as metric for checking (in this case Kbytes is just too big to be a reliable metric).
REMOTE_FILE=`ssh root@<ip-address> 'du -sb /var/data/*' | grep $1 | awk {'print $1'}`
LOCAL_FILE=`du -sb /var/data/$1 | awk {'print $1'}`
if [ $REMOTE_FILE == $LOCAL_FILE ]
then
rm -rf /var/data/$1else
echo some error sending file $1. i'll try again later. >>/var/log/send.logfi
sleep 300
but even when the directory is correctly transfered, the du command return different values when executed in the local and remote machine. so the directory is never deleted and is re-sended over and over again.
can anyone help me out with this one?
- 01-19-2009 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
try using this as first line:
REMOTE_FILE=`ssh root@<ip-address> du -sb /var/data/$1 | awk '{print $1}'`
you may need it like this
REMOTE_FILE=`ssh root@<ip-address> du -sb /var/data/ `$1` | awk '{print $1}'`
to expose the shell variablethe sun is new every day (heraclitus)
- 01-20-2009 #3
md5sum is the right tool you need to use..
the method you are following right now wont help you much, use md5sum.
- 01-20-2009 #4Just Joined!
- Join Date
- Jan 2009
- Posts
- 11
tks sathiya. i hadn't ever consider user a hash check (something much more reliable). i'll try here.


Reply With Quote