I prefer to use the first option, run each script separately against each host using runscript. That way, you get a log per server and success or failure by server.
In your script, there is no need to loop through the list of hosts as you are just dealing with one.
Within your script, if you need to know which server you are executing on, you can use the built in shell variable $NSH_RUNCMD_HOST.
To test such a script (say called 'example.nsh') from the command line, you call it like so:
If you need to do computations which cross hosts, then clearly this approach will not work for you. However, I find it works great for the most part and simplifies my scripts. Jarrod, any major drawbacks that you can see to this approach?
I would agree that the first option in the NSH Script types (the runscript option) makes the most sense, but someimes scripts need to run through some central actions before looping through a host list. In those cases, this formatting trick will help users to better format their output.