Pleased your found the problem. May I make a suggestion though. Rather
than having a loop why not simply use "sleep(2)" to give your system
a two seconds to do other things like housework rather than tying it
up in a unproductive resource user.
Cheers. Grahame
--- In "jklich" <> wrote:
>
> HA! It turned out that my C program exits if can't it connect to my
> database after one try! This is typical if the mysql deamon has not
> fully started. I tried starting my "pollster" daemon right after the
> mysql daemon -- to resolve this, I placed a loop in my C program that
> delays and retries to connect to the mysql database until it succeeds
> within a certain number of tries.
>
> BTW, syslog is disabled by default on the TS-7800 in order to reduce
> wear on the flash memory. I didn't know that. So for everyone who
> wants to collect data in the syslog, copy syslog.conf-debian to
> syslog.conf in the /etc directory. Just make sure you keep a copy of
> the old syslog.conf just in case you want to disable syslog again.
>
> Thanks for your help fellas!
>
> J
>
>
> --- In "wildpossumboy" <wildpossumboy@>
> wrote:
> >
> > Hi J.
> >
> > Have you checked to see if anything related to your program/process
> is
> > captured in the syslog?
> >
> > Failing that, why not use some log statements to see in what area
> the
> > problem maybe appearing.
> >
> > Hope this assists.
> > Cheers. Grahame
> >
> >
> > --- In "jklich" <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:
> > >
> > > :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/
|