Thank for your reply.
============This is content of crontab file ====================
19 2 * * * /etc/webmin/cron/tempdelete.pl
0 * * * * /etc/webmin/bandwidth/rotate.pl
0,10,20,30,40,50 * * * * sh /root/temp/testing/autoimport >> /root/temp/testing/errorlog
===================Script autoimport=======================
sh import Testfolder
My shell script below for import data to Oracle
it run okay. but the text display not correct follow order command executed.
=========================Shell Script import file=================
#!/bin/sh
#directory = ${1-'pwd'}
#run import data with SQLLoader
runSQLLoader()
{
/home/oracle/app/oracle/product/11.1.0/db_2/bin/sqlldr test/12345@orcl control=$1 bad=$2 log=$3 discard=$4 data=$5 direct=TRUE;
if [$? -ne 0]
then
return 1
else
return 0
fi
}
ARGS=1
filecontrol="ControlFile/test.ctl"
if [ $# -ne "$ARGS" ];
then
directory=`pwd`
else
directory=$1
fi
for file in $(find $directory -type f )
do
fname=`basename $file`
#display the file to miport data
echo "Excute importing file : $fname "
#asking user waiting for this job finish
echo "Please waiting for you look finished task"
errorfile="Error/$fname"
processedfile="Processed/$fname"
badfile="Processed/bad$fname"
discardfile="Processed/discard$fname"
logfile="Processed/log$fname"
#run function above
runSQLLoader $filecontrol $badfile $logfile $discardfile $file;
#get result of importing data if 1 have error or 0 it importing okay
if [$? -ne 0]
then
echo "Error ! Have an error happen during import data "
mv "$file" "$errorfile"
else
echo "Finish importing file : $fname"
mv "$file" "$processedfile"
fi
done | sort
exit 0
======================End Shell Script code=================
I has set chmod 777 to this file. I got e mail from cron have error like this :
/usr/bin/import: /usr/bin/import: cannot execute binary file.
I think, the name of my script file maybe similar with the system file.
I Has changed the file name to importdata and get this error sh: importdata No such file or directory.
Please I ask my problem when I run sheel script. If I run shell script from file name as importdata I got error Command not found.
But when I put sh in font of importdata it run okay ? Please explain for me more about this thing. Thank so much.
I am a newer. I try using the shell scritp only 3 day.
Thanks.