Lol, I guess I am trained now to spot errors and remember them. You keep putting the " in echo "trying "${fname} (${bname})" >&2
But now I notice it! Anyway, yeah here it is:
Quote:
box 1(root):/home/izivanov# sh dirsync6.sh
trying /opt/dba/scp/xxxxxxx (xxxxxxxxxxx)
local hash is xxxxxxxxxxxxxxxxxxxxx
MD5 (/opt/dba/scp/xxxxxxxxxx) = xxxxxxxxxxxxxxxxxxxxx
~
~
~
~
A couple of cannot open things on the bottom. Not really sure what that is!
---------- Post updated at 12:54 PM ---------- Previous update was at 12:50 PM ----------
Also what should I re-name the variable t with. My boss said that its not best practice to do that cause if anyone else looks at the script they won't know what the t stands for! I'm not sure what it stands for either! I know that it compares the hash-es of the files!
---------- Post updated at 12:55 PM ---------- Previous update was at 12:54 PM ----------
right, I was about to ask you about what to do if the files are different. My sync report got changed!
It's because not all your files are under /opt/dba/scp/. Check your list file and tell me, which ones should be converted from (whatever)/filename into /opt/dba/scp/filename, and which ones should be left as-is?
Or can they all be left as-is? In that case:
As for the syntax errors, ordinarily i'd try shell code I post on my own system before offering it to you but that's impossible for this script...
No I'm just kidding. I'm incredibly thankful and learning a ton just from these little things you're showing me! THank you so much!
Here is the output of my directory sync report. Thats the original notification about what needs to be updated! Maybe that will help you!
Quote:
root@: updating host
root@: updating host
root@: updating host
root@: updating host
root@: updating host
root@: updating host
root@box_: box_bkpa: /opt/sysadm/bin/xxxxxxxxx.sh: need to remove
root@box_: box_bkpa: /opt/sysadm/bin/xxxxxxxxxxx.sh: need to remove
root@box_: /opt/dba/scp/xxxxxxxxxxx: need to update
root@box_: /opt/dba/scpxxxxxxxxxxxx: need to update
root@box_: /opt/dba/scp/xxxxxxxxxxxxx: need to update
root@box_: /opt/dba/scp/xxxxxxxxxxxx: need to update
root@box_: /etc/sudoers: need to update
root@box_: /opt/dba/bin/xxxxxxxxxxxxx: need to update
So thats my original file I'm going off of!
Here is the ouput of the last change you suggested!
Quote:
(root):/home/izivanov# sh dirsync6.sh
trying /opt/dba/scp/xxxxxxxxxxxx (xxxxxxxxxxxx)
local hash is xxxxxxxxxxxxxxxxxxxxx
~
~
~
~
And sorry I had to remove the company server names. It might be confusing but I can't post that out here!
I'd be more interested in the contents of /home/izivanov/iz3 actually...
I spotted an error in my script. I left a bname in when inappropriate.
And one really should check the return value of md5 here. It bizzarely spews its errors to stdout, so whenever something goes wrong, the loop checks garbage vs garbage and decides everything's OK.
---------- Post updated at 01:24 PM ---------- Previous update was at 01:20 PM ----------
And the last code suggestion you had! I think it gives the same output as before!
Quote:
(root):/home/izivanov# sh dirsync6.sh
trying /opt/dba/scp/xxxxxxxxxxxxx
local hash is xxxxxxxxxxxxxxxxxxxxxxxxx
trying /opt/dba/scp/xxxxxxxxxxxxxxxxxxxx
local hash is xxxxxxxxxxxxxxxxxxxxx
certainly not the same output; for one thing it properly takes the md5 of sudoers now and never did before.
But argh, there's NO REASON for it to immediately break the loop like that given the data you've shown me. There's not even any break statement in it, it can't break until read actually fails! And because you're always stripping out the box names I'll never know what it really, really says and what your your hosts command actually, really prints. I could easily be missing something obvious.
You never told me what one bit of code did. I'll update it:
---------- Post updated at 01:24 PM ---------- Previous update was at 01:07 PM ----------
[edit] The only possible thing that could be eating all the filenames before they're read is ssh. You don't have the usual md5sum command; maybe it's still trying to read from standard input, and in doing so, eating all the output from hosts. Try this:
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)