LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   simple script but error (http://www.linuxquestions.org/questions/programming-9/simple-script-but-error-155968/)

ryedunn 03-10-2004 04:15 PM

simple script but error
 
Im reading an article on how to compile/run samba manually... everything is going great but in the article it reads to create a file and put this in it:
Code:

#!/bin/sh
# Begin /etc/init.d/samba

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

case "$1" in
        start)
                echo -n "Starting Samba daemon..."
                loadproc /usr/local/sbin/nmbd

                echo -n "...Samba daemon started!"
                loadproc /usr/local/sbin/smbd
                ;;

        stop)
                echo -n "Stopping Samba daemon!"
                killproc smbd

                echo -n "...Samba daemon stopped."
                killproc nmbd
                ;;

        reload)
        echo -n "Reloading Samba daemon configuration file..."
                reloadproc smbd
        ireloadproc nmbd
                ;;

        restart)
                $0 stop
                /usr/bin/sleep 1
                $0 start
                ;;

        status)
                statusproc /usr/local/sbin/nmbd
                statusproc /usr/local/sbin/smbd
                ;;

        *)
                echo "Usage: $0 {start|stop|reload|restart|status}"
                exit 1
        ;;

esac

# End /etc/init.d/samba

the problem is that Im getting the error: loadproc not found.

Im sure its a easy fix but Im still learning so Im not sure if that and the other commands (statusproc, ireloadproc, etc..) will work.

Thank you,
The GNUbie

acid_kewpie 03-10-2004 06:13 PM

these functions will be defined in "/etc/init.d/functions", the source command works the same an a #include in c.... these functions are not universal across linux, most distros write their own. have a look at your own functions script, and an existing init script for a service like... gpm, cron or similar to see the equivalent functions they use and adapt accordingly

ryedunn 03-10-2004 11:47 PM

Cool but one last thing
 
Chris,
Thank you really helped a lot but this is strange, the script says:
./usr/local/sbin/nmbd
Which should work but when I try to run it from the command line I get the same error as when its ran:
bash: ./usr/local/sbin/nmbd: No such file or directory
BUT, when I
#cd /usr/local/sbin
#./nmbd
it works just fine. WTF is going on????

The GNUbie

bigearsbilly 03-11-2004 05:01 AM

should that not be:

/usr/local/sbin/nmbd

NOT

./usr/local/sbin/nmbd


lose the dot

billy

ryedunn 03-11-2004 08:02 AM

yeup... thanks again.


All times are GMT -5. The time now is 10:06 PM.