On Sun, 1 Feb 2009, jklich wrote:
> Hi everyone,
>
> I'm using a TS-7800. I wrote a C program that I would like to run in
> the background automatically on startup. The binary, named pollster,
> is located in /usr/sbin:
>
> -rwxr-xr-x 1 root root 11635 Jan 31 16:01 /usr/sbin/pollster*
>
> I wrote a daemon script called pollster and placed in in /etc/init.d,
> here is the contents:
make sure the program is a true daemon. Check out this website...
http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html
>
> :init.d# cat pollster
> #! /bin/sh
>
> set -e
>
> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
> DESC="pollster daemon"
> NAME=pollster
> DAEMON=/usr/sbin/$NAME
> PIDFILE=/var/run/$NAME.pid
> SCRIPTNAME=/etc/init.d/$NAME
>
> test -x $DAEMON || exit 0
>
> d_start() {
> start-stop-daemon --start --verbose --background --make-
> pidfile --pidfile $PIDFILE --exec $DAEMON
> }
>
> d_stop() {
> start-stop-daemon --stop --verbose --pidfile $PIDFILE \
> --name $NAME
> }
>
> d_reload() {
> start-stop-daemon --stop --quiet --pidfile $PIDFILE \
> --name $NAME --signal 1
> }
>
> case "$1" in
> start)
> echo -n "Starting $DESC: $NAME"
> d_start
> echo "."
> ;;
> stop)
> echo -n "Stopping $DESC: $NAME"
> d_stop
> echo "."
> ;;
> *)
> # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-
> reload}" >&2
> echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}"
>> &2
> exit 1
> ;;
> esac
>
> exit 0
>
> ----------
>
> I can start and stop the deamon just fine from the command line by
> using:
>
> # /etc/init.d/pollster start
> OR
> # /etc/init.d/pollster stop
>
> When I issue a "ps -A" command, I see the process running, so I know
> everything up to here works just fine:
>
> 1116 ? 00:00:00 pollster
>
>
> So then I issued the folowing command for the various run-levels:
>
> # update-rc pollster start 99 2 3 4 5 . stop 0 1 6 .
>
> I see my pollster program start without any errors at startup, but
> when I login and check to see if it is running, it is not. I run
> "ps -A" and it is nowhere to be found. BUT, if I start it from the
> command line-- no problem. Anyone know what what could be wrong???
>
> J
>
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|