Pushing Changes to CWs

The following commands will produce a list of the Configured Workstation (CW) names, one on each line:

getent netgroup ConfiguredWorkstations | sed -e 's/^[^(]*(//' -e 's/,[^(]*(/\n/g' -e 's/,.*//'

Or if you prefer them on all on one line:

getent netgroup ConfiguredWorkstations | sed -e 's/^[^(]*(//' -e 's/,[^(]*(/ /g' -e 's/,.*//'

To execute the command 'echo -n `hostname`:;uptime' on every CW, sorted by hostname, you can then do:

getent netgroup ConfiguredWorkstations | sed -e 's/^[^(]*(//' -e 's/,[^(]*(/\n/g' -e 's/,.*//' | sort | xargs -I{} ssh {} 'echo -n `hostname`:;uptime'

To install the package 'enscript' on every CW:

getent netgroup ConfiguredWorkstations | sed -e 's/^[^(]*(//' -e 's/,[^(]*(/\n/g' -e 's/,.*//' | xargs -I{} ssh root@{} 'apt-get -y install enscript'