Find the answer to your Linux question:
Results 1 to 5 of 5
Hi all, Im new to the forum and fairly new to Linux as well. my apologies if this is posted in the wrong section. My problem is How can you ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2010
    Posts
    3

    How to search for a file in multiple machines simultaniously


    Hi all,

    Im new to the forum and fairly new to Linux as well. my apologies if this is posted in the wrong section.

    My problem is

    How can you search for a file in multiple machines (like a server farm) ? For example i log onto machine num1 and want to search for a file named "xxx.yyy" which may be in one of 4 machnies.

    What i do right now is manually log into each machine and run the find command. However i have heard that it is possible to do it via a couple of simple commands.

    I have looked into pssh and cssh as well as ssh tunneling (along with public key authentication to stop the machines requesting a password every time i log in) and unfortunately i was unable to find an answer. I would appreciate any help on this.

    Tx in advance

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,390
    Well, the only "global file indexes" of your server farm might be your backup system (bacula, etc) and/or system integrity checkers like aide, tripwire.

    Other than that, there is the way you already know:
    Log in (via pssh, etc) and search for your files.

    You might want to look into
    Code:
    man locate
    which is faster than a find, but probably (slightly) out of date.
    Last edited by Irithori; 09-15-2010 at 07:22 AM.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Sep 2010
    Posts
    3
    hi

    tx for the info. Could it be possible for you to elaborate on the steps of preparing a script for my requirements. Coz i really couldnt find a way of doing it via pssh,cssh and ssh tunneling

  4. #4
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,390
    Some questions:
    - How come, you dont know where file xxx.yy will be generated/copied?
    - How will the files be generated/copied?
    - When will the files be generated/copied?
    - How often will the files be generated/copied?

    Apart from that,
    Implementing key based authentication via ssh (google it) is a good idea anyway.

    Once that is in place, you would just use something like this:
    Code:
    cssh <num1> <num2> <num3> etc
    or
    Code:
    pssh -h <hostlist> "locate xxx.yy"
    where <hostlist> is a textfile containing a list of your hosts.
    You must always face the curtain with a bow.

  5. #5
    Just Joined!
    Join Date
    Sep 2010
    Posts
    3
    hi tx for your reply. I think you pretty much described the best way to do it.

    to answer your questsions.

    The files will be generated by an application that creates them for certain events. Depending on certain environmental settings the file will be generated in one of the servers that are part of the server farm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •