|
How to catch and handle Makefile exceptions
I have a simple makefile which I use to sync libraries files from /source/sybase directory on the source machine where the Makefile resides to /destination/folder on the various destination machines like machine1, machine2, machine3 using solaris utility 'rsync'. So when I run "make -f makefilename synclibraries", the sync goes through fine on all the machines. However if one of the machines (eg: machine2) is down, then makefile aborts midway because rsync fails and skips the sync on all the subsequent machines. Is there a way to capture the rsync error inside the Makefile and skip those machines which are down and proceed with syncing the subsequent machines ? If so how can I modify the below Makefile code. This would be really helpful because in future I would be expanding this makefile to handle 100s' of machines and it would be hard to track and rerun, if Make aborts midway due to an issue with any of those machines
MACHINELIST = loginname@machine1 \
loginname@machine2 \
loginname@machine3 \
loginname@machine4
synclibraries :
for target in $(MACHINELIST); do /usr/local/bin/rsync -avb --suffix .bk -e 'ssh -x' -n /source/sybase $$target:/destination/folder; done
Your help/suggestions would be greatly appreciated
thanks
Waavman
|