Re: Why wont this script run??

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

 



Ben Stringer wrote:
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

Ok i ran a dos2unix on the file, and that fixed it (my path to bash was ok). However now it only kills apache when i do a restart, it does never print out "Starting httpd" when running a restart, although if i run start it works???

Ok i agree on reinstalling apache, but how can i do this, and will it owerwrite my httpd.conf?

Best regards
Søren


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

  Powered by Linux