Why wont this script run??
Ben Stringer
ben at burbong.com
Wed Oct 12 14:42:18 UTC 2005
On Wed, 2005-10-12 at 15:36 +0200, Søren Neigaard wrote:
> 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:
>
> --- SCRIPT ---
> #!/bin/bash
>
> start() {
> echo "Starting httpd"
> /usr/sbin/httpd
> }
> stop() {
> echo "Stopping httpd"
> killall -9 httpd
> rm -f /var/run/httpd.pid /var/lock/subsys/httpd
> }
>
> restart() {
> stop
> start
> }
>
> case "$1" in
> start)
> start
> ;;
> stop)
> stop
> ;;
> restart)
> restart
> ;;
> *)
> echo $"Usage: $0 {start|stop|restart}"
> exit 1
> esac
>
> exit $?
> --- SCRIPT ---
>
> But it gives me this:
>
> : bad interpreter: No such file or directory
>
> Im no shell programmer, so i have no clue... Any ideas folks?
Did you write the script on a windows system, then copy it over to a
linux system (I noticed you are using a Windows email client)? This
error can be due to problems with carriage return/line feed characters.
Your script syntax looks fine - this error will be due to the file
format, permissions or the shell environment.
BTW - if you broke your apache startup script, just install/re-install
apache to recover it. Easier than trying to reinvent the wheel :)
Cheers, Ben
More information about the fedora-list
mailing list