Why wont this script run??

Shockwave shockwave at clan-tf20.com
Wed Oct 12 18:05:44 UTC 2005


> Somehow my /etc/init.d/httpd script broke (i did not alter it), and i
> dont know how to fix it, but i found out that simply running
> "/usr/sbin/httpd" starts apache, but apachectl does not. So my plan was
> to make a really simple script that runs "/usr/sbin/httpd" like the
> following:
>

<snip>

>
> But it gives me this:
>
> : bad interpreter: No such file or directory
>
> Im no shell programmer, so i have no clue... Any ideas folks?
>

Hi Søren,

The only time I have seen the error message you are getting is when the
shebang line is incorrect.  That's the first line that starts with:

#!/bin/bash

This tells the system where to find the program that will run the commands
contained within the file.  Since your file apparently references the
default location of bash, try doing the following at the command line as the
user who wants to execute that file:

which bash

If the bash executable can be found, it will tell you where it found it like
this:

[tom at frodo ~]$ which bash
/bin/bash
[tom at frodo ~]$

If the system can't find it, a message will displayed that looks something
like this:

[tom at frodo ~]$ which bashx
/usr/bin/which: no bashx in
(/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/lib/jre/
bin:/home/tom/bin)
[tom at frodo ~]$

You also may want to ensure you are running the bash shell by executing the
following:

[tom at frodo ~]$ echo $SHELL
/bin/bash
[tom at frodo ~]$

If it doesn't come back with what I showed above, then you are running a
different shell.  If everything to this point looks good, you can always try
looking at the permissions for the executable:

[tom at frodo ~]$ ls -lZ /bin/bash
-rwxr-xr-x  root     root     system_u:object_r:shell_exec_t   /bin/bash
[tom at frodo ~]$

I have SELinux enabled on my system, so the extra "Z" parameter shows the
security contexts of the file as well as the regular permissions.  Any
variance from what is shown above may also factor into your problem.

Give some of these things a try and let me know what you find.


Shockwave




More information about the fedora-list mailing list