I need help with this script. When I run it, I get the following error:
./testscript.sh: line 77: syntax error: unexpected end of file
I can't figure out why this is happening. Any help would be greatly appreciated.
Code:
#!/bin/bash
disks=(`cat /etc/default/filesys | grep "bdev=/dev/d" | cut -c11-13`)
date=`date +%m%d%Y`
log=(/testscript_${disks[0]}_$date.log /testscript_${disks[1]}_$date.log\
/testscript_${disks[2]}_$date.log /testscript_${disks[3]}_$date.log)
echo ""
echo "****************************************************"
echo "* *"
echo "* This script will give you the option to synchronize *"
echo "* a individual drive or multiple drives from TST001 to *"
echo "* the corresponding drive or drives on TST003. *"
echo "* *"
echo "****************************************************"
echo ""
echo -n "Choose a drive to be sycnchronize:"
echo ""
echo ""
cat <<- ENDIT
1) ${disks[0]}
2) ${disks[1]}
3) ${disks[2]}
4) ${disks[3]}
5) Synchronize multiple drives
ENDIT
read choice
if [ $choice = "1" ] || [ $choice = "2" ] || [ $choice = "3" ] || [ $choice = "4" ]
then
case $choice in
1) rsync -avz -e ssh --rsync-path=$RSYNC root@tst001:/du0/ /du0 | tee -a ${log[0]}
echo "" | tee -a ${log[0]}
;;
2) rsync -avz -e ssh --rsync-path=$RSYNC root@tst001:/du1/ /du1 | tee -a ${log[1]}
echo "" | tee -a ${log[1]}
;;
3) rsync -avz -e ssh --rsync-path=$RSYNC root@tst001:/du2/ /du2 | tee -a ${log[2]}
echo "" | tee -a ${log[2]}
;;
4) rsync -avz -e ssh --rsync-path=$RSYNC root@tst001:/du3/ /du3 | tee -a ${log[3]}
echo "" | tee -a ${log[3]}
;;
esac
elif [ $choice = "5" ]
then
echo -n "Define the drives you want to synchronize: [ ex: du2 du3 ]"
echo ""
read -a drives
for I in ${drives[*]}
do
if [ $I = "du0" ]
then
rsync -avz -e ssh --rsync-path=$RSYNC root@tst001://${I}// //${I} | tee -a ${log[0]}
echo "" | tee -a ${log[0]}
elif [ $I = "du1" ]
then
rsync -avz -e ssh --rsync-path=$RSYNC root@tst001://${I}// //${I} | tee -a ${log[1]}
echo "" | tee -a ${log[1]}
elif [ $I = "du2" ]
then
rsync -avz -e ssh --rsync-path=$RSYNC root@tst001://${I}// //${I} | tee -a ${log[2]}
echo "" | tee -a ${log[2]}
elif [ $I = "du3" ]
then
rsync -avz -e ssh --rsync-path=$RSYNC root@tst001://${I}// //${I} | tee -a ${log[3]}
echo "" | tee -a ${log[3]}
else
echo "Not a valid data drive. Exiting program now!!!"
echo ""
exit 1
fi
Last edited by Perderabo; 03-30-2005 at 12:04 PM..
Reason: Add code tags for readability
I'm new to utilities like socat and netcat and I'm not clear if they will do what I need.
I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes.
I'm using Cygwin bash on Windows 10.
My... (3 Replies)
Hello all,
I am facing a weird issue while executing a code below -
#!/bin/bash
cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset
sh UKBA_publish.sh UKBA 28082015 3
if
then
echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below.
#masterscript.sh
./callingscript.sh
echo $fileExist
#callingscript.sh
echo "The script is called"... (2 Replies)
I am using blow script :--
#!/bin/bash
FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not
if
then
# echo "process found"
exit 0;
else
echo "process not found"
exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Hi guys
I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file.
#!/bin/sh
echo " $2 $3 $4 $5 $6 $7
isql -w400 -U$2 -S$5 -P$3 << xxx
use $4
go
print"**Changes to the table... (0 Replies)