Im new to unix command. I would like to execute jasper file P70152R1 and pass busDt param to that file.
Currently hit this error >>> line 51: syntax error at line 53: `newline' unexpected
Can anyone help me to check my shell script.
Below is my script:
echo "*********************************************************"
echo "* xxxxxxxxxxxxxxxxxxxxxxxxx *"
echo "*********************************************************"
echo
echo "*********************************************************************************"
echo "* xxxxxxxxxxxxxxxxxxxxxxxx *"
echo "* UP *"
echo "* P700152R1 - AAAAAAAAAAAAAAAAAAA REPORT *"
echo "* P700152R2 - BBBBBBBBBBBBBBBBBBB REPORT *"
echo "* P700152R3 - CCCCCCCCCCCCCCCCCCC REPORT *"
echo "* (JP700152) *"
echo "* FREQUENCY : DAILY *"
echo ****************************************************************************"
echo
cd $MAIN/CWJCL/ACQ
export JCL=$MAIN/CWJCL/ACQ
export PRM=$MAIN/CWPRM/ACQ:$MAIN/CWPRM/CMN
export JAS=$MAIN/CWRPT/ACQ
export rptDir=$MAIN/ACQ/DAILYRPT
export LOG=$MAIN/CWLOG/ACQ
echo "Start Time and Date : \c" &&date
echo
JP70152=`date +%Y%m%d%H%M%S`
$JCL/strtJob $JP70152 JP70152
# Classpath
. $JCL/SETENV
#export CLASSPATH=$CLASSPATH:$PRM:$LIB/acq-1.0.jar
export CLASSPATH=$CLASSPATH:$PRM:"$MAIN/CWLIB/classes/acq"
# Get Business Date
echo "set heading off;" > $LOG/busDtSel.sql
echo "spool $LOG/date.log;" >> $LOG/busDtSel.sql
echo "ALTER SESSION SET CURRENT_SCHEMA=CCPS;" >> $LOG/busDtSel.sql
echo "SELECT 'CURRENT-BUSS-DATE:'||F9_AP008_BUS_DT FROM AP008;" >> $LOG/busDtSel.sql
echo "spool off;" >> $LOG/busDtSel.sql
echo "EXIT;" >> $LOG/busDtSel.sql
echo
$JCL/CONNAM.sh $LOG/busDtSel.sql $LOG/sel_day
a=$?
if [ ! $a -eq 0 ]
then
return $a
fi
tmpDt=`grep CURRENT-BUSS-DATE $LOG/date.log`
busDt=${tmpDt##*:}
# run program.
yyyymmdd=`date +%Y%m%d`
$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator -Ttxt -J$JAS/P70152R1.jasper -DACQ -O$rptDir/P70152R1.rpt -P<BUS-DATE:$busDt>
##########$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator -Ttxt -J$JAS/P70152R2.jasper -DACQ -O$rptDir/P70152R2.rpt -P<BUS-DATE:$busDt>
##########$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator -Ttxt -J$JAS/P70152R3.jasper -DACQ -O$rptDir/P70152R3.rpt -P<BUS-DATE:$busDt>
a=$?
echo $a
if [ ! $a -eq 0 ]
then
return $a
fi
echo
echo
echo
$JCL/endJob $JP70152 JP70152
echo "End Time and Date : \c" &&date
echo
return $a
Really appreciate your help. Thanks id advance !
The < and > characters have a special meaning in bash. You used them in
echo "set heading off;" > $LOG/busDtSel.sql
to redirect the output of the echo to $LOG/busDtSel.sql.
In your line 53, you do:
$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator options -P<BUS-DATE:$busDt>
That means that the last argument for the JRGenerator is -P, that the stdin comes from the file BUS-DATE:$busDt and that stdout goes to, ehm, nothing. There is a new-line. That is unexpected for bash, because it expected a destination for stdout. Hence the error message.
The solution is to use quotes:
$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator options "-P<BUS-DATE:$busDt>"
There are other issues in your script as well; for example: there is a line with:
echo ************************************"
which should obviously be:
echo "************************************"
I think that this might be a mistake in putting the script in the question, because this generates a different error message for me.
You forgot to add a " at the beginning of a line and therefore screws up everything:
echo "*********************************************************************************"
echo "* xxxxxxxxxxxxxxxxxxxxxxxx *"
echo "* UP *"
echo "* P700152R1 - AAAAAAAAAAAAAAAAAAA REPORT *"
echo "* P700152R2 - BBBBBBBBBBBBBBBBBBB REPORT *"
echo "* P700152R3 - CCCCCCCCCCCCCCCCCCC REPORT *"
echo "* (JP700152) *"
echo "* FREQUENCY : DAILY *"
HERE -> echo ****************************************************************************"
Hi you are using > operator at the end of your java command. Better use a escape sequence to overcome this issue. See below correct expression.
$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator -Ttxt -J$JAS/P70152R1.jasper -DACQ -O$rptDir/P70152R1.rpt -P\<BUS-DATE:$busDt\>
or, you can try like below as Ljm provided in his answer:-
$JAVA_HOME/bin/java my.com.eprotea.report.JRGenerator -Ttxt -J$JAS/P70152R1.jasper -DACQ -O$rptDir/P70152R1.rpt "-P<BUS-DATE:$busDt>"
Related
I am new to Linux bash scripting and I can't seem to find what I'm doing wrong. Here's my code. Entering number 2 and 3, after the prompt that I ask the user my code stops it doesn't continue to the IF ELSE statements. Thank you to those who will help!
#!/bin/bash
while true
do
clear
echo "Please enter one of the following options"
echo "1. Move empty files"
echo "2. Check file size"
echo "3. Which file is newer"
echo "4. File check rwx"
echo "5. Exit".
echo -e "Enter Choice:"
read answer
case "$answer" in
1) ./move_empty
exit 55 ;;
2) echo "Enter a filename"
read filename
if [ -f $filename ];
then ./file_size
fi
;;
3) echo "Enter first file:"
read filename
echo "Enter second file:"
read filename2
if [ ! -f "$filename" ];
then
echo "Supplied file name" $filename "does not exist";
if [ $filename" -nt $filename" ]; then
echo $filename "is newer"
exit 1fi
fi ;;
5) exit ;;
esac
done
If you have completed the check at ShellCheck.net, then you should have received:
$ shellcheck myscript
No issues detected!
If you didn't work it down to that point, you are not done. You have multiple quoting problems in your script and you compare $filename -nt $filename (which is always false). Small "attention to detail" issues that make a big difference. ShellCheck.net does a thorough job, but will not find logic issues, those are left to you. The cleanup of your quoting would look similar to:
#!/bin/bash
while true
do
clear
echo "Please enter one of the following options"
echo "1. Move empty files"
echo "2. Check file size"
echo "3. Which file is newer"
echo "4. File check rwx"
echo "5. Exit".
echo -n "Enter Choice: "
read -r answer
case "$answer" in
1) ./move_empty
exit 55
;;
2) echo -n "Enter a filename: "
read -r filename
if [ -f "$filename" ]
then
./file_size
fi
;;
3) echo -n "Enter first file: "
read -r filename
echo -n "Enter second file: "
read -r filename2
if [ ! -f "$filename2" ]
then
echo "Supplied file name $filename does not exist";
if [ "$filename" -nt "$filename2" ]; then
echo "$filename is newer"
exit 1
fi
fi
;;
5) exit
;;
esac
done
(note: you do not need echo -e as there are no backslash escaped characters to handle in your prompt, likely you intended -n to prevent the addition of a newline at the end of the prompt)
(also note: the use of clear, while fine for some terminals, will cause problems with others. Just be aware of the potential issue.)
If your then is on the same line with your conditional expression, e.g. if [ "$filename" -nt "$filename2" ]; then then a ';' is needed after the closing ']' to indicate a newline, otherwise, there is no need for a ';'.
Logic Problems
As discussed, the logic problems are not caught by ShellCheck and you must work though the code. It looks like you intended something like the following:
3) echo -n "Enter first file: "
read -r filename
echo -n "Enter second file: "
read -r filename2
if [ ! -f "$filename" ] || [ ! -f "$filename2" ]
then
echo "Supplied file '$filename' or '$filename2' does not exist";
exit 1
fi
if [ "$filename" -nt "$filename2" ]; then
echo "$filename is newer"
else
echo "$filename2 is newer"
fi
;;
You just have to take it line by line...
Look things over and let me know if you have further questions.
I am writing a script to fix a missing 'F' letter in a mail log file. The mail log file is continuously updating. I am getting a file name, after that I am doing 'sudo su' to get superuser access. Inside sudo, I am fixing a that missing 'F'. However, I am unable to use that file name inside sudo block. Please can anyone help me how I can export these shell variables inside sudo? I tried using export but its not working. the code block I have created is as follows-
#Script to solve F issue
#----------------------------------------
#By Kapil Shirsath
#----------------------------------------
cd /var/spool/mail #mail files reside in mail folder
echo "Entered in mail folder"
filename=`ls -lrt 99999*| sort -k 5 -rn | head -1 | tr -s " " "," | cut -d "," -f "8"` # this will list the file with maximum size`
echo "File with maximum size is $filename"
echo "----------------------------------------------------"
echo "Is it the file expected?(y/n)"
read choice
if test $choice == "n"
then
echo "Exiting...."
exit;
fi;
c=1
while [ $c -le 5 ]
do
ls -lrt $filename
echo $filename
sleep 3
c=`expr $c + 1`
done
echo "---------------------------------------------------"
sudo su<<'HERE' #this will give you super user permissions
echo "Got root access"
echo "First line of the file is as below :"
head -1 $filename
echo "---------------------------------------"
firstline=`head -1 $filename`
echo "Repeat : $firstline"
echo $firstline | grep ^"rom" >/dev/null
if test $? -eq 0
then
ex -s $filename <<'EOF'
1s/^/F/
:wq
EOF
echo "F issue fixed!"
HERE
c=1
while [ $c -le 5 ]
do
ls -lrt $filename
sleep 3
c=`expr $c + 1`
done
echo "---------------------------------------------------"
else
echo "Not finding the missing 'F' ! !! Kindly check with your system "
exit;
fi;
I have a basic menu that completes tasks that have already been set to me, i have the menu to show up and the functions to work, however, when the user chooses option 4, the results only blink in the terminal for a split second, and also if they choose an incorrect value, the error message blinks, i need both of them to stay put. Any ideas?
#!/bin/bash
#
# Script to perform some simple tasks
#
chmod 755 TaskB.sh
while:
do
clear
echo "*********************"
echo "* Tools *"
echo "*********************"
echo "* [1] Install gnome-disk-utility and gparted *"
echo "* [2] Create CET103Demo.txt *"
echo "* [3] Delete CET103Demo.txt *"
echo "* [4] Search BASH *"
echo "* [0] Exit/Stop *"
echo "*********************"
echo -n "Enter your menu choice [0-4]: "
read yourch
case $yourch in
1) sudo apt-get install gparted gnome-disk-utility ;;
2) cat > Desktop/CET103Demo.txt;;
3) rm Desktop/CET103Demo.txt;;
4) grep -H -r "BASH" /home/mintuser/.profile ;;
0) exit 0;;
*) echo "Oooops!!! Please select choice 1,2,3,4 or 0";
echo "Press Enter to continue..."; read ;;
esac
done
I haven't used bash in a while but try this:
#!/bin/bash
#
# Script to perform some simple tasks
#
chmod 755 TaskB.sh
while:
do
clear
echo "*********************"
echo "* Tools *"
echo "*********************"
echo "* [1] Install gnome-disk-utility and gparted *"
echo "* [2] Create CET103Demo.txt *"
echo "* [3] Delete CET103Demo.txt *"
echo "* [4] Search BASH *"
echo "* [0] Exit/Stop *"
echo "*********************"
echo -n "Enter your menu choice [0-4]: "
read yourch
case $yourch in
1) sudo apt-get install gparted gnome-disk-utility ;;
2) cat > Desktop/CET103Demo.txt;;
3) rm Desktop/CET103Demo.txt;;
4) grep -H -r "BASH" /home/mintuser/.profile ;;
0) exit 0;;
*) echo "Oooops!!! Please select choice 1,2,3,4 or 0" ;;
esac
read -p "Press [Enter] to continue..."
done
read -p "Press [Enter] to exit..."
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Below script is to push file to remote location through sftp,i faced lot of issues to write below code.But still i am facing some issue,Please guid me to resolve the issues.It's not working with sh.it is only working with ksh.
#test script
#-------------------------------------------------------------------
#!/bin/sh
#------------------------------------------------------------------------
# sftp_file_uploads.sh
#------------------------------------------------------------------------
export REMOTE_SERVER_PROD='192.168.0.1'
export REMOTE_SERVER_FAILOVER='192.168.0.2'
export SFTP_PORT='0001'
export SOURCE_FUNCTIONAL_ID='testusr'
export SOURCE_FILE_DIRECTORY='/var/temp/files/'
export SOURCE_ARCHIVE_DIRECTORY='/var/temp/files/archive'
export DATE_FORMAT=`date "+%Y%m%d"`
export LOG_DIRECTORY='/var/temp/logs'
export DESTINATION_FILE_DIRECTORY='/dest'
export LOG_FILE='$LOG_DIRECTORY/test_$DATE_FORMAT.log'
export SFTP_BATCH_FILE='/var/tmp/SFTP_BATCH_FILE'
#------------------------------------------------------------------------
# Find if the files are available at the source directory.
#------------------------------------------------------------------------
cd $SOURCE_FILE_DIRECTORY
export FILE_TO_UPLOAD_TESTD=`ls -lrt TESTD$DATE_FORMAT.csv | awk '/TESTD/{ f=$NF };END{ print f }'`
export FILE_TO_UPLOAD_TESTDF=`ls -lrt TESTDF$DATE_FORMAT.csv | awk '/TESTDF/{ f=$NF };END{ print f }'`
#------------------------------------------------------------------------
# Try 2 times and Sleep for 5 mins if either of the files is not present
#------------------------------------------------------------------------
counter=0
flag_file_found_TESTD=0
flag_file_found_TESTDF=0
while [ $counter –lt 2 ]
do
#---------------------------
# Check TESTD file arrived
#---------------------------
if [ -z $FILE_TO_UPLOAD_TESTD ] then
echo “No TESTD file to transfer. Sleeping for 5 mins” >> $LOG_FILE
sleep 300
else
echo “TESTD file found to transfer.” >> $LOG_FILE
flag_file_found_TESTD=1
fi
#---------------------------
# Check TESTDF file arrived
#---------------------------
if [ -z $FILE_TO_UPLOAD_TESTDF ] then
echo “No TESTDF file to transfer. Sleeping for 5 mins” >> $LOG_FILE
sleep 300
else
echo “TESTDF file found to transfer.” >> $LOG_FILE
flag_file_found_TESTDF =1
fi
if [[ flag_file_found_TESTD == 1 &&
flag_file_found_TESTDF == 1 ]] then
echo “Both files are found.” >> $LOG_FILE
break
else
echo “At least one of the files is not found. Retrying now.” >> $LOG_FILE
fi
counter=`expr $counter + 1`
done
if [[ flag_file_found_TESTD == 1 &&
flag_file_found_TESTDF == 1 ]] then
echo “Both files are found.”
break
else
if [ flag_file_found_TESTD == 0 ] then
echo “test file is not found and two attempts completed. Cannot transfer the file for today.” >> $LOG_FILE
fi
if [flag_file_found_TESTDF == 0 ] then
echo “test1 file is not found and two attempts completed. Cannot transfer the file for today.” >> $LOG_FILE
fi
fi
#------------------------------------------------------------------------
# Create sftp script
#------------------------------------------------------------------------
rm -f $SFTP_BATCH_FILE
echo "lcd $SOURCE_FILE_DIRECTORY " > $SFTP_BATCH_FILE
echo "cd $DESTINATION_FILE_DIRECTORY " >> $SFTP_BATCH_FILE
if [ -z $FILE_TO_UPLOAD_TESTD ] then
echo "put $FILE_TO_UPLOAD_TESTD " >> $SFTP_BATCH_FILE
fi
if [ -z $FILE_TO_UPLOAD_TESTDF ] then
echo "put $FILE_TO_UPLOAD_TESTDF " >> $SFTP_BATCH_FILE
fi
echo "bye" >> $SFTP_BATCH_FILE
#------------------------------------------------------------------------
# Do sftp
#------------------------------------------------------------------------
echo " Before SFTP " >> $LOG_FILE
if [[ -z $ FILE_TO_UPLOAD && -z $ FILE_TO_UPLOAD1 ]] then
echo “No files to transfer” >> $LOG_FILE
mv $LOG_FILE $LOG_DIRECTORY
exit 1
else
echo “Attempting to connect to Remote Server $REMOTE_SERVER_PROD” >> $LOG_FILE
/usr/bin/sftp –v -oPort=$SFTP_PORT -b $SFTP_BATCH_FILE $SOURCE_FUNCTIONAL_ID#$REMOTE_SERVER_PROD >> $LOG_FILE 2 >> $LOG_FILE
fi
result=$?
errorConnectToProd=0
if [ $result -eq 0 ]
then
echo "SFTP completed successfully to Prod Remote Server" >> $LOG_FILE
else
errorConnectToProd=1
if [[ $result -eq 4 || $result -eq 5 ]]
echo "FAILED to connect to Server. " >> $LOG_FILE
else
echo "FAILED to SFTP to Remote Server. " >> $LOG_FILE
fi
fi
if [ errorConnectToProd == 1 ] then
echo “Attempting to connect to FAILOVER Remote Server $REMOTE_SERVER_FAILOVER” >> $LOG_FILE
/usr/bin/sftp –v -oPort=$SFTP_PORT -b $SFTP_BATCH_FILE $SOURCE_FUNCTIONAL_ID#$REMOTE_SERVER_FAILOVER >> $LOG_FILE 2 >> $LOG_FILE
fi
result=$?
if [ $result -eq 0 ]
then
echo "SFTP completed successfully to Failover Remote Server" >> $LOG_FILE
else
echo "FAILED to SFTP to Failover Remote Server. " >> $LOG_FILE
mv $LOG_FILE $LOG_DIRECTORY
exit 1
fi
fi
cd $SOURCE_FILE_DIRECTORY
mv $FILE_TO_UPLOAD_TESTD $SOURCE_ARCHIVE_DIRECTORY
echo “Moved $FILE_TO_UPLOAD_TESTD to archive direcotry.” >> $LOG_FILE
mv $FILE_TO_UPLOAD_TESTDF $SOURCE_ARCHIVE_DIRECTORY
echo “Moved $FILE_TO_UPLOAD_TESTDF to archive direcotry.” >> $LOG_FILE
rm -f $SFTP_BATCH_FILE
echo “Deleted the SFTP Batch file.” >> $LOG_FILE
echo “Upload completed.” >> $LOG_FILE
mv $LOG_FILE $LOG_DIRECTORY
exit 0
Getting below Errors:
test.ksh[41]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[55]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[56]: flag_file_found_TESTDF: not found
test.ksh[65]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[41]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[55]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[56]: flag_file_found_TESTNDF: not found
test.ksh[65]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[79]: [flag_file_found_TESTDF: not found
rm: /var/tmp/SFTP_BATCH_FILE is a directory
test.ksh[89]: /var/tmp/SFTP_BATCH_FILE: cannot create
test.ksh[90]: /var/tmp/SFTP_BATCH_FILE: cannot create
test.ksh[97]: B: not found
test.ksh[98]: B: not found
test.ksh[99]: B: not found
test.ksh[100]: B: not found
test.ksh[101]: B: not found
test.ksh[102]: B: not found
test.ksh[106]: /var/tmp/SFTP_BATCH_FILE: cannot create
test.ksh[113]: $LOG_DIRECTORY/test_$DATE_FORMAT.log: cannot create
test.ksh[114]: syntax error at line 114 : `FILE_TO_UPLOAD' unexpected
Regards,
Chai
This line is wrong:
export LOG_FILE='$LOG_DIRECTORY/test_$DATE_FORMAT.log'
It should use double quotes, so that the variables will be expanded:
export LOG_FILE="$LOG_DIRECTORY/test_$DATE_FORMAT.log"
Another error:
if [flag_file_found_TESTDF == 0 ] then
needs a space after [. [ is a command (it's a synonym for test), and all commands are separated from their arguments by spaces.
The whole section labeled "Create sftp script" is failing because /var/tmp/SFTP_BATCH_FILE already exists and is a directory; rm -f won't delete a directory, you need to use rm -rf.
if [[ flag_file_found_TESTD == 1 &&
flag_file_found_TESTDF == 1 ]] then
is missing the $ before the variable names.
if [[ -z $ FILE_TO_UPLOAD && -z $ FILE_TO_UPLOAD1 ]] then
Get rid of the space after $.
UPDATE 2:
In all your if statements, you're missing the ; (or newline) before then.
I'm not sure what's causing all the "B: not found" errors. But after you fix all the other errors, maybe it will go away or be easier to find.
I have written the following script but i am getting error sqlcorn.sh: No such file or directory
here is the script
#!/bin/bash
ORACLE_HOME="/opt/app/oracle/product/11.2.0/dbhome_1"
ORACLE_SID="HEER"
ORACLE_USER="USER1"
ORACLE_PASSWORD="USERP"
echo "export ORACLE_HOME=$ORACLE_HOME" >> sqlcronprocedure.sh
echo "export PATH=\$ORACLE_HOME/bin:\$PATH" >> sqlcronprocedure.sh
echo "export ORACLE_SID=$ORACLE_SID" >> sqlcronprocedure.sh
echo "rTmpDir=/tmp" >> sqlcronprocedure.sh
echo "sqlplus -s $ORACLE_USER#$ORACLE_SID/$ORACLE_PASSWORD > $rTmpDir/deleteme.txt 2>&1 <<EOF" >> sqlcronprocedure.sh
echo " select 1 from dual;" >> sqlcronprocedure.sh
echo " execute someproc(1000,14);" >> sqlcronprocedure.sh
echo "EOF" >> sqlcronprocedure.sh
chmod 755 sqlcronprocedure.sh
crontab -l > sqlcron.sh
echo "0,15,30,45 * * * * /sqlcronprocedure.sh" >> sqlcron.sh
crontab sqlcorn.sh
This is my first ever script. so i apologize if things are too obvious to ask
The real problem: You misspelled the file name on the crontab command. Change it from:
crontab sqlcorn.sh
to
crontab sqlcron.sh
Some more comments on your code:
Your multiple echo commands are better written as a "here document". Rather than this:
echo "export ORACLE_HOME=$ORACLE_HOME" >> sqlcronprocedure.sh
echo "export PATH=\$ORACLE_HOME/bin:\$PATH" >> sqlcronprocedure.sh
echo "export ORACLE_SID=$ORACLE_SID" >> sqlcronprocedure.sh
echo "rTmpDir=/tmp" >> sqlcronprocedure.sh
echo "sqlplus -s $ORACLE_USER#$ORACLE_SID/$ORACLE_PASSWORD > $rTmpDir/deleteme.txt 2>&1 <<EOF" >> sqlcronprocedure.sh
echo " select 1 from dual;" >> sqlcronprocedure.sh
echo " execute someproc(1000,14);" >> sqlcronprocedure.sh
echo "EOF" >> sqlcronprocedure.sh
you can do this:
cat <<EOF >sqlcronprocedure.sh
export ORACLE_HOME=$ORACLE_HOME
export PATH=\$ORACLE_HOME/bin:\$PATH
export ORACLE_SID=$ORACLE_SID
rTmpDir=/tmp
EOF
cat <<END_OF_SCRIPT >sqlcronprocedure.sh
export ORACLE_HOME=$ORACLE_HOME
export PATH=\$ORACLE_HOME/bin:\$PATH
export ORACLE_SID=$ORACLE_SID
rTmpDir=/tmp
sqlplus -s $ORACLE_USER#$ORACLE_SID/$ORACLE_PASSWORD > $rTmpDir/deleteme.txt 2>&1 <<EOF
select 1 from dual;
execute someproc(1000,14);
EOF
END_OF_SCRIPT
which is a bit easier to read. (Your version wasn't incorrect, just hard to read and error-prone; you have to get the >> sqlcronprocedure.sh right on eacn and every line.)
Note: You use >> to build sqlcronprocedure.sh, which appends to the existing sqlcronprocedure.sh if it exists. I don't think that's what you want to do; you probably want to create the file from scratch. My code assumes you want to create the file rather than appending to it.
The last part of your script:
crontab -l > sqlcron.sh
echo "0,15,30,45 * * * * /sqlcronprocedure.sh" >> sqlcron.sh
crontab sqlcorn.sh
is fine except for two things.
First sqlcron.sh is not a good name for the file, since it's not a shell script; just call it sqlcron. The system doesn't care, but you should.
Second, the misspelling I mentioned above.
you need to specify the full path to sqlcron.sh in your script...