The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: convert shell script for looping
Bestmiler
Newbie
Rank: 1



UID 69
Digest Posts 0
Credits 0
Posts 15
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 19, 2007 02:23 PM  Profile | P.M. 
convert shell script for looping



convert shell script for looping



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 (obviously), 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:


code:

#!/bin/bash
#
# purpose: to use rsync to synchronize the mirroragent.logs of phd users
#
# create variables
rsync="/usr/bin/rsync"
ropts="-az -e ssh"
admin="alatorre@cshs.org"
src="cardenasv@awm2212a.csmc.edu:~/library/logs/mirroragent.log"
dst="/volumes/data2/ma_logs/cardenasv/"
thelog="/library/logs/mysync.log"
#
# 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
fi
exit 0
# end script


Top
cosmokramer
Newbie
Rank: 1



UID 97
Digest Posts 0
Credits 0
Posts 37
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 19, 2007 02:24 PM  Profile | P.M. 
yes, it does. this is exactly what i was looking for. thanks, much.
Top
karan265
Newbie
Rank: 1



UID 214
Digest Posts 0
Credits 0
Posts 78
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 19, 2007 02:24 PM  Profile | P.M. 
i can't claim credit, really.

i got it from
http://www.tldp.org/ldp/abs/html/
Top
 

 

All times are GMT, the time now is Jul 31, 2010 03:27 AM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.006355 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP