Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter, but I would like to add other workstations to this script as they are converted to phd's so they can be checked to see if the phd is working as it should (another script down the line). I reason that I need to convert this script to loop through the workstation names. I'm looking for any helpful suggestions for how to do this:

# purpose: to use rsync to synchronize the MirrorAgent.logs of PHD users 
# create variables 
ROpts="-az -e ssh" 
# sync MirrorAgent.log 
time $RSYNC $ROpts $SRC $DST >> $theLog 
# test to see if sync completed successfully 
if [ ! $? = 0 ]; then 
        echo "MA_log SYNC NOT COMPLETED!!!" >> $theLog 
        echo "MirrorAgent.log not synced!" | mail -s "MA log sync problem" $ADMIN 
exit 0 
# end script

Thanks in advance.

Does this help ?



while read workstation_name
     #do you stuff with workstation_name
     echo "Read workstation name: " $workstation_name
done < $file_with_workstations_list

Yes, it does. This is exactly what I need. Thanks, much. :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.