#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    25
    Rep Power
    0

    Run Script Multiple Time Silmutanies


    Thanks to you guys I'm almost finish the script that I was ask to done in my job.When was asked, I just knew little bit about scripting, but I liked the challenge and I told them that I'm willing to do it. I'm a network engineer, so as you might know by my previews post, my script is ablut ssh into cisco devices. I finish my script, but the list of devices that I to run it is really big. I did a test run, and the script is been running for hours(2000) devices. My question is how can I run the script and instead of the script SSH into each device at a time, the script will SSH let say 4 times at a time simultaneously. Thanks in advance
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,840
    Rep Power
    480
    http://docs.python.org/library/multiprocessing.html#using-a-pool-of-workers

    The multiprocessing module is quite easy to use, it might help.


    Also, without refreshing my recollection of your earlier solution so this advice may not apply, process creation takes a lot of resources. Arrange your code to have more commands per process and fewer processes.
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo