#!/bin/bash echo "ParaSync version 07122k2-c" if [ -z $1 ]; then echo "No targets specified. You need to specify a target host" echo "to which you want this program to send the goodies." exit 1 fi echo "Do you want STEALTH MODE? (Program runs in background with no" echo "visible output to the screen.)" echo " " echo "Any value entered here will initiate VERBOSE operation." echo "For SILENT operation, just hit enter at the prompt." read SILENT if [ -z $SILENT ]; then echo "Running in STEALTH mode." else SILENT=v echo "Running in VERBOSE mode." fi echo "Do you want the DELETE switch?" read DUMMY echo "What is the SOURCE directory?" read SOURCE echo "What is the DESTINATION directory?" read DESTINATION echo "rsh or ssh?" read RPC case "$RPC" in rsh | ssh) echo '-----------------------------------------------' echo ' SPAWNING RSYNC DAEMONS.... ' echo '-----------------------------------------------' echo "You chose method $RPC" for i in $1 $2 $3 $4 $5 $6 $7 $8 $9; do echo " " echo "PARASYNC PROCESSES RUNNING: $i...." case "$DUMMY" in y) echo '------------- DELETE SWITCH ON -------------------------' rsync -e $RPC -a$SILENT ${SOURCE} $i:${DESTINATION} --delete & ;; *) rsync -e $RPC -a$SILENT ${SOURCE} $i:${DESTINATION} & ;; esac echo "-----------------------------------------------------------------------" done ;; *) echo "Invalid input. You need to select either rsh or ssh." exit 1 ;; esac echo '------------------------------------------' echo ' Taking Care of Business.... ' echo '------------------------------------------' ps -ef | grep rsync echo '------------------------------------------' echo 'This table shows the RSYNC daemons we have spawned and that are ' echo 'still active'. echo 'Other daemons not listed have already completed (or possibly died)' echo 'Would you like to wait to see if they terminate?' read AREWEDONE case "$AREWEDONE" in n|N|no|NO|No) echo "Exiting at your request. Please remember to check that" echo "the RSYNC processes listed above complete their tasks." exit 0 ;; *) while $e; do echo "Here's what's still cookin'" echo '=============================================' ps -ef | grep rsync echo '=============================================' echo "Check again?" read WAITLONGER case "$WAITLONGER" in n|N|no|NO|No) echo "To be honest, I was getting bored, too." echo "Don't forget to kill any stale daemons that might" echo "still be floating around. Use the chart above to" echo "identify their pids." exit 0 ;; *) ;; esac done ;; esac exit 0