The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Run perl file in Crontab error. raccsdl Shell Programming and Scripting 2 11-13-2007 07:07 AM
Can crontab execute binary files? Tris UNIX for Dummies Questions & Answers 5 12-07-2006 02:16 PM
Need to execute a complete url from crontab nissar Shell Programming and Scripting 2 08-11-2006 05:18 AM
compiled binary file gives "cannot execute binary file" scgupta SUN Solaris 0 07-13-2006 01:59 AM
crontab ..sqlplus cannot execute zikronz High Level Programming 1 04-29-2005 10:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-09-2007
raccsdl raccsdl is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 8
Crontab error Cannot execute binary file.

Anyone can help me ?

I try to using crontab with a simple shell script as echo it run okay but now i have more command in script. when I set entry to crontab and whe it run i get mail with error cannot execute binary file.

it urgent so please help me the soutions. Thank so much for your help.
  #2 (permalink)  
Old 11-09-2007
ipzig ipzig is offline
Registered User
  
 

Join Date: Aug 2005
Location: in my heart. ..kidding. Calcutta, India.
Posts: 13
Please post your crontab file text and the script text as well.

Even if I myself may not be able to solve your problem even after seeing those, but it will surely help anyone who is knowledgeable enough.

Also check that your script has execute permission .
  #3 (permalink)  
Old 11-10-2007
raccsdl raccsdl is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 8
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.
  #4 (permalink)  
Old 11-10-2007
luckybalaji luckybalaji is offline
Registered User
  
 

Join Date: Nov 2007
Location: Singapore
Posts: 7
Existing :
sh import Testfolder

change to
sh <full_path>/import Testfolder
  #5 (permalink)  
Old 11-10-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by raccsdl View Post
/usr/bin/import: /usr/bin/import: cannot execute binary file.
99% of problems with cron are that the environment is minimal and none of your profile is run. Basically you will be running as you, have $HOME setup and that's about it.
  #6 (permalink)  
Old 11-13-2007
raccsdl raccsdl is offline
Registered User
  
 

Join Date: Nov 2007
Posts: 8
Hi Porter.

How do I config enviroment for my case. I run it when I login with root it run okay. I add that script to crontab it cannot run.

Please help me the solution or example. Thanks so much.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:14 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0