automatical execution of a program on a startup

slim vslim at insightbb.com
Sat May 29 09:09:02 UTC 2004


On Sat, 2004-05-29 at 03:54, Tomek Kabarowski wrote:
> 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 at 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 at acer tk]$
> 
> 
> I also created symbolic links to it in every /etc/rc.d/rc[0-6].d/
> directory...
> 
> [tk at 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 at 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 at 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
> 
dont know if this will help but
http://linux.toshiba-dme.co.jp/ML/tlinux-users/5000/5019.html
> 
> 
> 





More information about the fedora-list mailing list