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

automatical execution of a program on a startup



Hello (again :-) )...

I want to make FC2 automatically load a program which should work all
the time in background...I thought it would be similar to other
automatically loadable programs, as httpd, so I created the following
script, and put it in /etc/rc.d/init.d/:

[tk acer tk]$ cat /etc/rc.d/init.d/slmodemd
#!/bin/sh
# Startup script for slmodemd
#
# Source function library.
. /etc/rc.d/init.d/functions
 
[ -f /usr/sbin/slmodemd ] || exit 0
 
prog="slmodemd"
options="--country=POLAND /dev/slamr0"
 
start() {
    echo -n $"Starting $prog: "
    daemon $prog $options
    RETVAL=$?
    echo
    return $RETVAL
}
 
stop() {
        echo -n $"Stopping $prog: "
        killall -HUP $prog
        echo
        RETVAL=$?
        return $RETVAL
}
 
case "$1" in
        start)
            start
            ;;
 
        stop)
            stop
            ;;
 
        status)
            status $prog
            ;;
        restart)
            stop
            start
            ;;
        *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 1
esac
 
exit $RETVAL
[tk acer tk]$


I also created symbolic links to it in every /etc/rc.d/rc[0-6].d/
directory...

[tk acer rc0.d]$ ls -l K15slmodemd
lrwxrwxrwx  1 root root 18 maj 28 18:10 K15slmodemd ->../init.d/slmodemd

...actually I don't know what are this 'K' or 'S' on the beginning mean
:(, but I created only 'K' one as it is for httpd. I also don't know if
'15' number is somehow significant.

Actually, after all this, the script still doesn't seem to load on a
startup. /var/log/messages shows nothing about it :(
WHAT IS WRONG?

I also tried to put execution code in /etc/rc.d/rc.local

[tk acer rc.d]$ cat rc.local
#!/bin/sh
touch /var/lock/subsys/local
echo "Starting modem:"
daemon /usr/sbin/slmodemd --country=POLAND /dev/slamr0
RETVAL=$?
echo
[tk acer rc.d]$

But the result is the same - script slmodemd doesn't start....

What do I do wrong? How should I make my system execute some code on a
startup?

Regards,
Tomek







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