Re: [foxboro] Env variable from C-shell scripts

  • From: "Johnson, Alex P \(IPS\)" <alex.johnson@xxxxxxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Thu, 12 Jul 2007 12:21:58 -0400

Good thinking. =


Of course, you would need to add a little more code. There are going to
be a lot of =3Dxx in this. Read it as just an equals sign. The mailing
list converts equal signs into =3Dxx for reasons known only to mail code
writers.

Your script should be placed in /opt/myPrograms/scripts, BTW. :)

#!/bin/sh
HOME=3D/opt/myPrograms
LOGS=3D$HOME/logs
DATA=3D$HOME/data
MY_NAME=3D`basename $0`
mkdir -p $LOGS
mkdir -p $DATA
exec <$LOGS/$MY_NAME 2<&1
set -x

DM_NAME=3D$1
DEFAULT_DM_TYPE=3D<your default dm type: DM or FV>
DM_TYPE=3D

MY_PID=3D`pref -$DMNAME DMPID`

ps -ef | grep $MY_PID >$DATA/$MY_NAME
if [ $? =3D 0 ]
then
   DM_TYPE=3DFV
else
   ps -ef | grep $MY_PID | grep dm_wp50
   if [ $? =3D 0 ]
   then
      DM_TYPE=3DDM
   else
      ps -ef | grep $MY_PID | grep default_dm
      if [ $? =3D 0 ]
      then
         DM_TYPE=3DDEFAULT_DM_TYPE
      fi
   fi
fi

if [ DM_TYPE. =3D . ]
then
   echo Unknown DM type for $DMNAME
   exit 1
fi

echo $DMTYPE

Regards,

Alex Johnson
Invensys Systems, Inc.
10900 Equity Drive
Houston, TX 77041
713.329.8472 (voice)
713.329.1700 (fax)
713.329.1600 (switchboard)
alex.johnson@xxxxxxxxxxxxxxxx


-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of Grumelart, Alain
Sent: Thursday, July 12, 2007 11:10 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Env variable from C-shell scripts

You can find out if a particular FV or DM is running a particular  dm
name with the following method.

Pid=3D3D`Pref -<dmName> DMPID`
Ps -ef | grep $pid

That will tell you which of the two is running =3D



Alain Grumelart Ing.
Systems Integration & IT
Invensys Systems Canada Inc.
-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of Johnson, Alex P (IPS)
Sent: Thursday, July 12, 2007 11:54 AM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Env variable from C-shell scripts

Re: Documentation
The document for all of the DM variables and commands is Display
Commands - B0193DF. You may already know that, but just in case.


Re: Determining FV or DM

I'm not aware of a way to tell a DM or FV apart using DM Commands or any
other mechanism. =3D3D




Re: Getting the Environment name

The DM variable ENV contains the name of the current environment.

You can get it into a script using:


/usr/local/pref -<dmName> ENV


I don't use the C-shell, I use the Bourne shell. In that shell, the
syntax would be:

MY_ENV=3D3D3D`/usr/local/pref -<dmName> ENV`


Regards,

Alex Johnson
Invensys Systems, Inc.
10900 Equity Drive
Houston, TX 77041
713.329.8472 (voice)
713.329.1700 (fax)
713.329.1600 (switchboard)
alex.johnson@xxxxxxxxxxxxxxxx


-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx]
On Behalf Of Ghiglione, Alessandro
Sent: Thursday, July 12, 2007 10:07 AM
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] Env variable from C-shell scripts

Hi to everybody, =3D3D

This is my first question: It's a real partecipated forum, where I
learnt each day a little bit more!
My question is: from C-shell scripts, I need to know the content of some
environment variable on a specific DMNAME.
I'm curious to know, by querying variables:
1) if a specified DMNAME uses FoxView or DisplayManager -we adopt both
on the same station-.
2) the name of current env provided by FV bottom line -without the
directory path-.
I looked for all documented resources; I got some results at the cost of
embarassing tricks....

Regards,
Alessandro Ghiglione
Senior Application Engineer

Infineum Italia s.r.l.
Strada di Scorrimento,2
17047 Vado Ligure (SV) - Italia
*   +39.019.2150.277 =3D3D

mob. +39.3484535196      =3D3D

*    +39.019.2150.326
* mailto:alessandro.ghiglione@xxxxxxxxxxxx


 =3D3D




 =3D3D

 =3D3D

_______________________________________________________________________
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
 =3D3D

foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3D3D3Djoin
to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3D3D3Dleave
 =3D3D




Confidentiality Notice:
The information contained in this electronic message and any
attachment(s) =3D3D
to this message are intended for the exclusive use of the recipient(s)
and =3D3D
may contain confidential, privileged or proprietary information. If you
are=3D3D
 not the intended recipient, please notify the sender immediately,
delete a=3D3D
ll copies of this message and any attachment(s). Any other use of the
E-Mai=3D3D
l by you is prohibited.


 =3D

 =3D

_______________________________________________________________________
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
 =3D

foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3D3Djoin
to unsubscribe:
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3D3Dleave
 =3D




Confidentiality Notice:
The information contained in this electronic message and any
attachment(s) =3D
to this message are intended for the exclusive use of the recipient(s)
and =3D
may contain confidential, privileged or proprietary information. If you
are=3D
 not the intended recipient, please notify the sender immediately,
delete a=3D
ll copies of this message and any attachment(s). Any other use of the
E-Mai=3D
l by you is prohibited.


 =

 =

_______________________________________________________________________
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=3Djoin
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
 =




Confidentiality Notice:
The information contained in this electronic message and any attachment(s) =
to this message are intended for the exclusive use of the recipient(s) and =
may contain confidential, privileged or proprietary information. If you are=
 not the intended recipient, please notify the sender immediately, delete a=
ll copies of this message and any attachment(s). Any other use of the E-Mai=
l by you is prohibited.


 
 
_______________________________________________________________________
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: