![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| please convert the below program into shell script | mail2sant | Shell Programming and Scripting | 3 | 04-10-2008 09:39 AM |
| convert cpp program to c shell script ? | domain | Shell Programming and Scripting | 2 | 12-12-2007 06:43 AM |
| looping through a variable in a shell script | ramachandranrr | Shell Programming and Scripting | 1 | 03-04-2007 08:02 PM |
| C Shell Script to convert a number into minutes | Ringo | Shell Programming and Scripting | 1 | 08-07-2003 02:24 PM |
| Looping a perl script in a shell script | edkung | Shell Programming and Scripting | 8 | 10-04-2002 11:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Done
With the help provided by the kind forum member, I was able to convert the script for looping:
Code:
#!/bin/bash
#
# purpose: to use rsync to synchronize the MirrorAgent.logs of PHD users
#
# create variables
PHDUSERS=`cat /Library/Scripts/shell/phd_users.txt`
RSYNC="/usr/bin/rsync"
ROpts="-az -e ssh"
ADMIN="alatorre@cshs.org"
#SRC="cardenasv@awm2212a.csmc.edu:~/Library/Logs/MirrorAgent.log"
theLog="/Library/Logs/mySync.log"
#
# sync MirrorAgent.logs
echo "*** MirrorAgent Log Sync ***" >> $theLog
echo "===> sync'd the following user MirrorAgent logs:" >> $theLog
for names in $PHDUSERS
do
theUser=`echo $names | awk -F@ '{print $1}'`
SRC="${names}:~/Library/Logs/MirrorAgent.log"
DST="/Volumes/Data2/MA_logs/${theUser}/"
$RSYNC $ROpts $SRC $DST
# test to see if sync completed successfully
if [ ! $? = 0 ]; then
eRR="${theUser} SYNC NOT COMPLETED!!!"
echo $eRR >> $theLog
echo $eRR | mail -s "MirrorAgent.log sync problem" $ADMIN
else
echo $theUser >> $theLog
fi
done
date >> $theLog
echo "---" >> $theLog
exit 0
# end script
|
|
||||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|