Forgive me, but if you need to do this exact same series of steps for around 400 computers I feel you are doing it backward. Instead of having your local machine send a script to these machines, why not have the machines download the script from you?
Assuming you have OpenSSH server running on your local machine (or if you have a server anywhere that you feel can host the script) you could put a crontab on your 400 machines that looks like this:
Code:
#!/bin/bash
# wait for a random period of time no more than one hour
sleep_time=$(($RANDOM % 3600))
sleep $sleep_time
# save the previous script used
mv command_script command_script-backup
# download new script
scp your-hostname:scriscript_name command_script
# don't run it if the script is hasn't changed
cmp command_script command_script-backup && exit 1
chmod 755 command_script
./command_script
Then enable a cron job to run the script for you as root once every hour/day/week. Just make sure that the remote machines
1) Have the script installed
2) Have the proper crontab entry
3) Have permission to access your machine or the server where the new script will be.
Bookmarks