Re: [foxboro] Foxapi Applications

  • From: "Dumitru, Alex" <adumitru@xxxxxxxxxx>
  • To: "'foxboro@xxxxxxxxxxxxx'" <foxboro@xxxxxxxxxxxxx>
  • Date: Thu, 28 Feb 2002 08:57:48 -0500

The only problem with the example loop is that the script will block until
FoxAPI is up and this way all subsequent scripts started through
user_apps.dat will never get a chance to do their job. 

We try to overcome this with a timeout:

###########################################################################
#
# wait for foxapi om_poll
#

MAXWAIT=180
DELAY=10
WAITTIME=0
OMPOLL=`ps -ef | grep "foxapi om_poll" | grep -v grep`
NOTRUNNING=$?

while [ ${NOTRUNNING} = 1 ]
do
        sleep ${DELAY}
        WAITTIME=`expr ${WAITTIME} + ${DELAY}`
        if [ ${WAITTIME} -gt ${MAXWAIT} ]
        then
                echo "FoxAPI did not start (MAXWAIT=${MAXWAIT} sec),
aborting ..
."
                exit 1
        fi
        OMPOLL=`ps -ef | grep "foxapi om_poll" | grep -v grep`
        NOTRUNNING=$?
done
###########################################################################

This part is inserted at the beginning of each script started by
user_apps.dat so if the FoxAPI did not start within the prescribed WAITTIME
there is an error message that will be kept in the user_apps.log file.

This way your subsequent scripts that have nothing to do with FoxAPI will be
started and if you parse the user_apps.log file at the end you can even make
some notifications about unsuccessful start attempts.

Hope this helps,

Alex
-----Original Message-----
From: Deen, Ron [mailto:rdeen@xxxxxxxxxxx]
Sent: Thursday, February 28, 2002 5:51 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Foxapi Applications



>>As a long time FoxAPI user, I can say that monitoring the processes is the
>>only technique that I could find.

Thanks for making me look smart ;-))

Ron

-----Original Message-----
From: Johnson, Alex (Foxboro) [mailto:ajohnson@xxxxxxxxxxx]
Sent: Thursday, February 28, 2002 7:57 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Foxapi Applications



As a long time FoxAPI user, I can say that monitoring the processes is the
only technique that I could find.


It's pretty easy to implement in /etc/fox/user_apps.dat. The script that
processes this file won't start the next script until the current one
completes so make sure the test is the first command run.


If you put your startup stuff in /etc/fox/rc.foxapps, you can simply add the
loop to that file since it is a script.


Regards,


Alex Johnson
System Products - Invensys Systems, Inc.
10707 Haddington
Houston, TX 77043
713.722.2859 (office)
713.722.2700 (switchboard)
713.932.0222 (fax)
ajohnson@xxxxxxxxxxx <mailto:ajohnson@xxxxxxxxxxx> 



        -----Original Message-----
        From:   Deen, Ron [SMTP:rdeen@xxxxxxxxxxx]
        Sent:   Thursday, February 28, 2002 12:54 AM
        To:     foxboro@xxxxxxxxxxxxx
        Subject:        Re: [foxboro] Foxapi Applications


        >>
        I was hoping that there was some nice
        method that does not involve looping to check for Foxapi
        << 
        So do I. But this is what I came up with for my application. Any
smarter
        solution around that can be shared?
        You could just "sleep long" but I don't like that approach myself
(well not
        in a script that is), does any real programmer have any thoughts on
this
        subject?

        Of course you don't have to watch for FoxAPI in every program start
script.
        Just do it once and if FoxAPI is running all depending progs can be
        processed.
        That last remark was probably just annoying but I pressed "Send"
before I
        could remove it.

        Regards

        Ron Deen

        -----Original Message---
        From: Joe Sanguinetti [mailto:Joe.Sanguinetti@xxxxxxxxxxxx]
        Sent: Wednesday, February 27, 2002 6:50 PM
        To: 'foxboro@xxxxxxxxxxxxx'
        Subject: Re: [foxboro] Foxapi Applications


        Thanks,  

                I am doing something similar.  I was hoping that there was
some nice
        method that does not involve looping to check for Foxapi.

        Thanks Again,
        Joe

        -----Original Message-----
        From: Wolf, John L. [mailto:jlwolf@xxxxxxxxxxxxxx]
        Sent: Wednesday, February 27, 2002 11:40 AM
        To: 'foxboro@xxxxxxxxxxxxx'
        Subject: Re: [foxboro] Foxapi Applications



        Hi Joe.
        A solution I employ was given to me by Ron Deen via the list.  I've
modified
        it slightly to fit our installation, but it works every time.  Here
is the
        email Ron sent to me:

        *****************************
        What I did for PI:
        In the script that starts the PI client I added a test for the
presence of
        the FoxAPI progs.
        The count of 5 programs (-lt 5) includes the "grep foxapi" utility
of
        course.

        while [ `ps -ef|grep foxapi|wc -l` -lt 5 ]
        do
           echo "Foxapi not running yet"
           sleep 10
        done

        After this I run the PI start script.
        Simple but at least a bit conditional. You can make it more
intelligent of
        course...

        ****************************

        Hope it answers your question.

             
              John L. Wolf
          Systems Analyst
        Tilden Mining Co. L.C.


        -----Original Message-----
        From: Joe Sanguinetti [mailto:Joe.Sanguinetti@xxxxxxxxxxxx]
        Sent: Wednesday, February 27, 2002 11:45 AM
        To: foxboro@xxxxxxxxxxxxx
        Subject: [foxboro] Foxapi Applications


        I have a few Applications that use Foxapi.  What is the best way to
start
        these up when the machine is rebooted so I know Foxapi is running
before I
        start them.  Does anyone have a good solution for this?

        Joe


         
         
        
_______________________________________________________________________
        This mailing list is neither sponsored nor endorsed by Invensys
Process
        Systems (formerly The Foxboro Company). Use the info you obtain here
at
        your own risks. Read
http://www.thecassandraproject.org/disclaimer.html
         
        foxboro mailing list:
//www.freelists.org/list/foxboro
        to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
        to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
         


         
         
        
_______________________________________________________________________
        This mailing list is neither sponsored nor endorsed by Invensys
Process
        Systems (formerly The Foxboro Company). Use the info you obtain here
at
        your own risks. Read
http://www.thecassandraproject.org/disclaimer.html
         
        foxboro mailing list:
//www.freelists.org/list/foxboro
        to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
        to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
         


         
         
        
_______________________________________________________________________
        This mailing list is neither sponsored nor endorsed by Invensys
Process
        Systems (formerly The Foxboro Company). Use the info you obtain here
at
        your own risks. Read
http://www.thecassandraproject.org/disclaimer.html
         
        foxboro mailing list:
//www.freelists.org/list/foxboro
        to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
        to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
         
         
         
        
_______________________________________________________________________
        This mailing list is neither sponsored nor endorsed by Invensys
Process
        Systems (formerly The Foxboro Company). Use the info you obtain here
at
        your own risks. Read
http://www.thecassandraproject.org/disclaimer.html
         
        foxboro mailing list:
//www.freelists.org/list/foxboro
        to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
        to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
         
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: