p-run

p-run is a utility that runs a program, script, or series of commands on a large number of hosts in parallel. It simplifies management of machines in computer labs. It uses ssh, and supports password and key-based authentication.

p-run uses libexpect, and will run in parallel across as many processes as specified. When run on a large number of hosts, its parallel nature significantly speeds up administration.

Downloading and compiling

p-run Usage

   Usage: p-run <arguments>
           [-user <username>] - use this user to log in
           [-host <hostname>] - add <hostname> to the list of hosts
           [-hosts <filename>] - add hosts from <filename> to the list of hosts
           [-cmd <command>] - add <command> to the list of commands
           [-script <filename>] - add commands from <filename>
           [-threads #] - execute in # threads
           [-nopass] - turn off password prompt
	   [-timeout #] - total time p-run is allowed to run (in seconds)
           [-version] - print version information
   

Example

p-run -hosts lists/test -cmd "hostname" -user root -threads 3
3 hosts, 1 commands, 3 threads
Enter password: 
*** - apple - ***

Last login: Mon Mar 31 12:10:39 2003 from asterix.cs.byu.edu
[root@apple root]# hostname
apple
[root@apple root]# 
*** - pear - ***

Last login: Mon Mar 31 12:11:27 2003 from asterix.cs.byu.edu
[root@pear root]# hostname
pear
[root@pear root]# 
*** - hockey - ***

Last login: Mon Mar 31 12:11:27 2003 from asterix.cs.byu.edu
[root@hockey root]# hostname
hockey
[root@hockey root]# 
Total Time: 00:00:01.51, clock time: 00:00:00.53, savings: 00:00:00.98, speedup: 2.84
   

ToDo

Among the things I'd like to do (or have done) with p-run:

License

p-run is released under the GNU General Public License, Version 2, June 1991.


TuxRocks.com © Copyright 2004-2009 Frank Sorenson.
All trademarks and copyrights on this page are owned by their respective owners.
Legal documents here are matters of public record.
Contact me via email at frank AT tuxrocks DOT com.