[WBEL-users] Shell Script Cannot run binary file

John Hinton webmaster@ew3d.com
Sun, 06 Jun 2004 13:25:40 -0400


Johnny Hughes wrote:

> On Sun, 2004-06-06 at 11:32, John Hinton wrote:
>
>>/Wondering if anybody else has experienced this. I can run this binary 
>>from the command line. If I make the exact same call from within a shell 
>>script, it gives a
>>
>>cannot execute binary file/
>>
> Make sure you are either calling the full path to the file (i.e. 
> */bin/grep*) ... or you have your PATH variable set in the script 
> (i.e. *PATH=/bin:/usr/bin:/usr/local/bin*)
>
> Johnny Hughes 

Ok, more info.

Spamprobe is a c compiled binary.

-rwxr-xr-x    1 root     root      1301574 May  2 13:14 spamprobe

If I run

su webmaster
/usr/local/bin/spamprobe cleanup 2 14

it runs fine

But, if I have a script called myfile2 containing

#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
su webmaster /usr/local/bin/spamprobe cleanup 2 14

(this was in a much longer script, pulled it out to do simplified 
testing. Same results for both)

[root@irongate bin]# ./myfile2
sh: /bin/sh: cannot execute binary file

and if I try doing away with the sh in the script, I get

[root@irongate bin]# ./myfile2
/usr/local/bin/spamprobe: /usr/local/bin/spamprobe: cannot execute 
binary file

The SpamProbe binary runs fine on RH 7.2

webmaster shell is set to /bin/sh in passwd

It's like there is some major change in the shells from 7.2 to RHEL. I 
also noticed that some characters did not transfer properly via rsync 
between the two machines. A unneeded character created by something 
editing files on a mac machine changed to some other char  when moved 
from one machine to the other. These did not show up on the old box, but 
made a ? show up in web pages on the new system. Odd.

Yes, I was on RH 7.2 until last month for productions servers. I just 
now believe apache 2 and more importantly, its modules are ready for 
primetime.

Thanks for any help on this one.... Seems I can't run any binary as any 
user from the shell.

Best,
John Hinton