How to find machinename the appserver is running on? - Forum - OpenEdge General - Progress Community

How to find machinename the appserver is running on?

 Forum

How to find machinename the appserver is running on?

This question is answered

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)

Verified Answer
  • 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
  • Could I use os-getenv('HOSTNAME') on both windows and linux?

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

  • 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
    ==============================================
     
  • 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.

  • 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

  • INPUT THROUGH VALUE("hostname").

    DEFINE VARIABLE host AS CHARACTER NO-UNDO.

    IMPORT host.

    INPUT CLOSE.

    MESSAGE host VIEW-AS ALERT-BOX.

  • 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.