That can't possibly have been the code you ran, a third of it's missing. I'm assuming you mean my second posted code?
Quote:
The only thing I added was #!/usr/bin/sh, cause my boss told me I would need it!
Not the way you're using it, you don't. The way you're using it you aren't even guaranteed /usr/bin/sh since you just type 'sh' and let your login shell run whatever sh comes first in your PATH. The #! line only matters when you run it like ./scriptname
The md5sum utility is part of openssh and found in many places. This md5 utility you have, I have no idea what it is; but with it's weird location( /usr/local/bin/ is where custom-built things usually get installed), its poor error behavior(dumping errors to stdout), and the vexing way it reads from stdin even when given a filename, it looks like a one-off to me -- not even a standard HP-UX utility. So how it actually behaves is something I've had to deduce like the blind man and the elephant.
I think that last code may actually have been working. It just never printed anything unless a host found an error. Quick, try this.
Last edited by Corona688; 03-09-2011 at 04:19 PM..
Sorry you're correct I posted before I checked what I copied to the reply box.
The code I ran right now:
and the result looked almost like th eone I got with his script! YAY!
But there is a difference. THey can't all be okay because my sync report told me just this morning that they weren't!
Here is the result!
Quote:
xxxx(root):/home/izivanov# sh dirsync6.sh
trying /opt/dba/scp/xxxxxxxxxxxxxx
local hash is xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxx /opt/dba/scp/xxxxxxxxxxx is okay!
xxxx/opt/dba/scp/xxxxxxxxxxx is okay!
~
~
~
It looks like xxxxx never got matched!
Let me check a coupe of files and servers for MD5 just to be safe maybe they got updated!
Well, check them. The script says /opt/dba/bin/bkginit.relaybkg on deva2 differs -- does it? And look at a file your report says differs but this script doesn't. Your report may be checking things this isn't. This checks their contents, not their owners, not their timestamps, not their permissions.
---------- Post updated at 02:36 PM ---------- Previous update was at 02:36 PM ----------
Quote:
It looks like dsva never got matched!
Isn't that the system you're running it from? Comparing itself to itself would be pretty futile.
Think they all match because $TMP still has result from local hash or previous host - probably safest to clear out $TMP on each loop
Also fname should be passed as a quoted string on the md5 command line not a seperate parameter on the ssh command line.
Change this line:
to:
Last edited by Chubler_XL; 03-09-2011 at 05:08 PM..
Okay, so we're feeding the output of /usr/local/bin/hosts into the loop like this:
...but anything in the loop can read read from that, not just the 'while' bit. If you do this:
...you get nothing but the first line.
I didn't expect the md5 command to read anything except the file it was given; that's not just the way md5sum works but the traditional way for UNIX commands to operate. Some read standard input when given no files, and some read standard input when told to read from -. I gave it a filename, and it read from the file, and when it finished that it read from the list, too! Throwing it all away and putting it into the checksum. I had to force it to read from /dev/null instead, which is a "special" file that always does nothing.
---------- Post updated at 03:11 PM ---------- Previous update was at 03:02 PM ----------
Quote:
Originally Posted by Chubler_XL
Think they all match because $TMP still has result from local hash or previous host
Sorry, but that's completely wrong. >always truncates the file, so the temp file was always completely replaced each time ssh was called. You could hardly expect your ">$TMP" to work if > didn't work that way! You have to use >> to append.
Thanks for your input Chubler, I did put in those corrections and still the same result although, although I don't really understand how to clear the $TMP on every loop!
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Dear all,
I have a directory named A and some subdirectories named B, C, D with .xml files. I want to use the following command to strip the file.
sed -re ':start s/<*>//g; /</ {N; b start}' file.xml > file.xml
At the same time, I want to remove the blank lines using
sed '/^$/d'
How can... (6 Replies)
Guys I want to do this:
copy:
/var/router/system1/config/backup/install.put
/var/router/system2/config/backup/install.put
/var/router/system3/config/backup/install.put
/var/router/system4/config/backup/install.put
into:
/var/router/system1/config/install.dat... (22 Replies)
Hello everyone,
I am looking to basically creating md5sum files for all iso files in a directory and archive the resulting md5 files into a single archive in that very same directory.
I worked out a clumsy solution such as:
#find files for which md5sum are to be created and store the... (1 Reply)
Hello - I am in process of deleting many files which are older than 4 weeks.
For example I am inside:
/subsystem/prod/
Files are with various extentions, but anything older than 4 weeks should be deleted.
What would be the most simplest script to acheive this? (4 Replies)
I have a local account for a unix server. The idle timeout for the account is around 10 mins. I have to login to the server multiple times during the day. Is there a way to increase the idle timeout or may be a script that I can run on background so it is not idle. Something like echo date every 9... (3 Replies)
I have several unix servers,
I need to logon to each server and find out if an id exists on that server.
I need a simple script for this, i have come up with the following script, but I cannot bring the output of a child process on the remote server.
for i in `cat SERVER_LIST`
do
ssh $i... (5 Replies)
Hi
I want to write a small script that will create folders named from `AAAA' all the way to `ZZZZ'.
That is:
`AAAA'
`AAAB'
`AAAC'
...
`AABA'
`AABB'
`AABC'
...
`ABAA'
`ABAB'
`ABAC'
...
`ABBA'
...
`ZZZZ' (4 Replies)
Can anyone direct me to a resource that explains scripting in simple terms?
I have visited many sites and browsed this forum and have yet to find simple explanations. (8 Replies)
I have a script that runs the grub-md5-crypt command based on whether the pass_value variable is a non-zero string. The md5 hash is being created in the /opt/hostconfigs/$HOST file, but I can't echo $md5_value. It is blank. Is there a way to create and echo a md5 hash variable?
if
then... (1 Reply)