How to find machinename the appserver is running on?

Posted by goo on 31-Jan-2017 06:42

we have several environments (developing, testing, testing2, production) and I would like to find the machinename on where the appbroker is running. Each environment can be running on either windows or linux. 

What would be the best way of getting that?

//Geir Otto (Openedge 11.3)

Posted by Rob Fitzpatrick on 31-Jan-2017 16:56

I do something like this:

define variable v-hostname as character no-undo.

if opsys = "win32" then
  v-hostname = os-getenv( "COMPUTERNAME" ).
else
  do:
    input through value( "uname -n" ).
    import v-hostname no-error.
    input close.
  end.

message v-hostname view-as alert-box.

All Replies

Posted by goo on 31-Jan-2017 06:49

Could I use os-getenv('HOSTNAME') on both windows and linux?

Posted by Brian K. Maher on 31-Jan-2017 06:52

if opsys = “win32” then
    assign vHostName = OS-GETENV(“COMPUTERNAME”).
else
    assign vHostName = OS-GETENV(“HOSTNAME”).
 
I think that will do it.

Posted by Scott Dulecki on 31-Jan-2017 06:56

Not sure about that, but if you grab smtpmail from oehive.org, you could use the gethostname.p program included in there.  It addresses both Unix (via uname -n) and Windows (via a wsock32.dll call).
 
Good luck.
 
Scott
 
==============================================
Scott M. Dulecki                   MPUG 16 Feb
Progress                          WMPUG 16 Feb
616/481-4313                    MWUG 19-21 Mar
sdulecki@progress.com                 SEUG TBD
==============================================
 

Posted by goo on 31-Jan-2017 11:06

Thanks :-)

Sendt fra min iPhone

Den 31. jan. 2017 kl. 13.53 skrev Brian K. Maher <bounce-maher@community.progress.com>:

Update from Progress Community
Brian K. Maher

if opsys = “win32” then
    assign vHostName = OS-GETENV(“COMPUTERNAME”).
else
    assign vHostName = OS-GETENV(“HOSTNAME”).
 
I think that will do it.

View online

 

You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

Flag this post as spam/abuse.

Posted by Stefan Drissen on 31-Jan-2017 16:22

While os-getenv( "HOSTNAME" ) works fine in an interactive session, on my Centos 5.5 box an AppServer always returns unknown value - this may be related to stackoverflow.com/.../unable-to-get-os-getenvhostname-work-during-the-startup

Posted by Matt Baker on 31-Jan-2017 16:32

INPUT THROUGH VALUE("hostname").

DEFINE VARIABLE host AS CHARACTER NO-UNDO.

IMPORT host.

INPUT CLOSE.

MESSAGE host VIEW-AS ALERT-BOX.

Posted by Rob Fitzpatrick on 31-Jan-2017 16:56

I do something like this:

define variable v-hostname as character no-undo.

if opsys = "win32" then
  v-hostname = os-getenv( "COMPUTERNAME" ).
else
  do:
    input through value( "uname -n" ).
    import v-hostname no-error.
    input close.
  end.

message v-hostname view-as alert-box.

This thread is closed