[WBEL-users] Shell Script Cannot run binary file
Johnny Hughes
mailing-lists@hughesjr.com
Sun, 06 Jun 2004 13:29:55 -0500
--=-2mS6S6jSsowubvw6bYDh
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Sun, 2004-06-06 at 12:25, John Hinton wrote:
> 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
>
try this:
su - webmaster -c "/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
> _______________________________________________
> Whitebox-users mailing list
> Whitebox-users@beau.org
> http://beau.org/mailman/listinfo/whitebox-users
--=-2mS6S6jSsowubvw6bYDh
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
On Sun, 2004-06-06 at 12:25, John Hinton wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>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
</I></FONT></PRE>
</BLOCKQUOTE>
try this:<BR>
<BR>
<TT>su - webmaster -c "<I>/usr/local/bin/spamprobe cleanup 2 14</I>"<BR>
</TT><BR>
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>(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
_______________________________________________
Whitebox-users mailing list
Whitebox-users@beau.org</FONT>
<A HREF="http://beau.org/mailman/listinfo/whitebox-users"><U>http://beau.org/mailman/listinfo/whitebox-users</U></I></A></PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-2mS6S6jSsowubvw6bYDh--