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)
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.
Could I use os-getenv('HOSTNAME') on both windows and linux?
Update from Progress Community
Brian K. Maher if opsys = “win32” thenassign vHostName = OS-GETENV(“COMPUTERNAME”).elseassign vHostName = OS-GETENV(“HOSTNAME”).I think that will do it.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.