Re: Why wont this script run??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@frodo ~]$ which bash
/bin/bash
[tom@frodo ~]$

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

[tom@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@frodo ~]$

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

[tom@frodo ~]$ echo $SHELL
/bin/bash
[tom@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@frodo ~]$ ls -lZ /bin/bash
-rwxr-xr-x  root     root     system_u:object_r:shell_exec_t   /bin/bash
[tom@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


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux