#!/bin/bash -p

# Finn Magnusson , finn.magnusson@ericsson.com

######################################################################################
#                                                                                    #
#  Ericsson AB 2001-2022    - All Rights Reserved                                   #
#                                                                                    #
# The copyright to the computer program(s) herein is the property   of Ericsson AB,  #
# Sweden. The programs may be used and/or copied only with the written permission    #
# from Ericsson AB or in accordance with the terms and  conditions stipulated in the #
# agreement/contract under which the program(s) have been supplied.                  #
#                                                                                    #
######################################################################################

##########################################################################
# Moshell folders location  (DO NOT EDIT)
##########################################################################
moshell_version="22.0v"
moshelldir=`dirname "$0"`
if [[ $moshelldir != /* ]] ; then moshelldir=`pwd`/$moshelldir ; fi
if [[ $moshelldir = /app/moshell/latest/moshell && -L /app/moshell/latest ]] ; then
   tmosdir=`ls -ld /app/moshell/latest`
   tmosdir=${tmosdir##* }
   if [[ $tmosdir = *[a-z]* ]] ; then moshelldir=/app/moshell/$tmosdir/moshell ; fi
fi
commonjardir="$moshelldir/commonjars"
sitefiledir="$moshelldir/sitefiles"

##########################################################################
# FOLLOWING SETTINGS ARE CUSTOMIZABLE BY EACH USER.
# If changes need to be made to the default values, it is recommended to do it in
# one of the following files:
#     moshell/jarxml/moshellrc (settings will apply to all users)
#     ~/.moshellrc             (settings will apply to own user only)
# It's also possible to specify a uservariable on session basis:
#     at moshell startup with "-v" option
#     or from within moshell, using the "uv" command
##########################################################################

#===============================================================================
# The list of uservariables that can only be set in the file moshell/moshell and cannot be overridden by user settings
#===============================================================================
#uv_blacklist=moscommandlog,moscommanddir,command_restriction,blocked_commands
uv_blacklist=check_numeric_hostname

#===============================================================================
# The list of uservariables that can only be set in the file moshell/moshell or moshell/jarxml/moshellrc or moshell/jarxml/moshellrc.$USER and cannot be overridden by ~/.moshellrc or uv command
#===============================================================================
#uv_greylist=moscommandlog,moscommanddir,command_restriction,blocked_commands

#===============================================================================
# Check if the moshell version is up to date. The latest moshell version available on utran01 server is checked at startup.
# A warning is printed if the current version is less than the newest version. This check is available from 10.0c onwards.
# 0=no check, 1=warning only, 2=exit if old version
# Default is 1 for moshell, and 0 for AMOS (since contact to utran01 server is necessary for the check)
#===============================================================================
moshellversion_check=1

#===============================================================================
# Check if the moshell version is not too old. Only done in case moshell version check could not be done (eg no contact to utran01 server)
# If the number of weeks between now and the release date of the current moshell version is greater than moshell_max_age then a warning is printed.
# 0=no check. Default 15 weeeks.
#===============================================================================
moshell_max_age=15

#===============================================================================
# Check if enough free RAM memory on the workstation:
# 0=no check, 1=warning only, 2=exit if not enough space
# Default is 0 for moshell, and 2 for AMOS
#=============================================================================== 
ram_check=0

#===============================================================================
# Check if enough free disk space on the workstation:
# 0=no check
# 1=warning if free disk space less than disk_limit
# 2=exit if free disk space less than disk_limit
# 3=warn if free fisk space below disk_limit_warn and exit if below disk_limit_high
# 4=same as 3 but also prevent mon command to run if free disk space below disk_limit_warn
# Default is 1 for moshell, and 4 for AMOS
#=============================================================================== 
disk_check=1

#===============================================================================
# The minimum free disk space and RAM memory
# Default 1G (1 Gigabyte)
# Syntax: G for gigabytes, M for megabytes, K for kilobytes
#===============================================================================
disk_limit=1G
ram_limit=1G

#===============================================================================
# Disk check with thresholds, used when disk_check>=3
# When disk usage of the moshell_logfiles partition is higher than disk_limit_warn (default: 70%) then a warning is printed.
# When disk usage of the moshell_logfiles partition is higher than disk_limit_high (default: 85%) then moshell will not start
#===============================================================================
disk_limit_warn=70
disk_limit_high=85

#===============================================================================
# The maximum number of allowed moshell sessions
# - max_sessions: max number of sessions allowed per user
# - max_sessions_all: total number of allowed sessions on the workstations
# Default 0 = unlimited number of sessions
#===============================================================================
max_sessions=0
max_sessions_all=0

#===============================================================================
# Catch CTRL-C
#  - 0: dont catch CTRL-C
#  - 1: (default) CTRL-C run while the moshell prompt is idle is disabled, to avoid accidentally killing the moshell session while trying to copy text to clipboard
#===============================================================================
catch_ctrl_c=1

#================================================================================
# jarxml directory (to store MOM files and jar files which are fetched from the node)
#================================================================================
jarxmldir=$moshelldir/jarxml

#================================================================================
# Path to java. Java version must be 1.4.2 or higher.
# The java_options can be used to pass on any options to the java process , eg "-mx1g" to set the maximum heap size
# To specify several java options, use comma sign as separator between the options. Eg: -mx1g,-ms1g
#================================================================================
java="/usr/bin/java"
java_options="-mx1g"

#================================================================================
# Setting the java property jacorb.security.ssl.client.cipher_suites when corba_class>=3
#   - use_jacorb_ciphers=0  => cipher_suites will not be set
#   - use_jacorb_ciphers=1  => cipher_suites will be set to the following defaults: TLS_RSA_WITH_AES_128_CBC_SHA if CPP<=17.Q3 and not set if CPP>=17.Q4
#   - use_jacorb_ciphers=2  => cipher_suites will be set to the value of the uservariable "jacorb_ciphers"
#================================================================================
use_jacorb_ciphers=1
jacorb_ciphers=""

#================================================================================
# Path to perl, used for commands pmr, pmx, steg, fclean
# Note: cannot be changed with the uv command, only from moshellrc file or -v option at startup
#================================================================================
perl="/usr/bin/perl"

#================================================================================
# IPDATABASE FILE : to specify node names and node passwords, see example in moshell/examples/ipdatabase
# several ipdatabase files can be specified, just separate them with commas.
# eg: ip_database=$sitefiledir/ipdatabase,/home/toto/myipdatabase
#================================================================================
ip_database=$sitefiledir/ipdatabase

#================================================================================
# CORBA CLASS:
#  1 = vbjorb (secure + unsecure nodes)
#  2 = jacorb unsecure
#  3 = jacorb secure with SAM credential (uses sa_credential and sa_password)
#  4 = jacorb secure with SLS login and dowload of nm_credential
#       (uses sls_urls, sls_username, sls_password and puts the NM credential in nm_credential)
#  5 = jacorb secure with NM credential (uses file located in nm_credential)
#================================================================================
corba_class=2

#================================================================================
# CORBA ORB init: the type of reference used for initialising the ORB
#  0 = connect with IOR file, with the property "NameRootIORPath" -> default setting
#  1 = connect with IP address and port, with the property "ORBInitRef.NameService"
#================================================================================
corba_orbinit=0

#================================================================================
# Path to jacorb files
# 0 = use the jacorb files in the user's jarxml folder
# 1 = use the jacorb files in the moshell/commonjars folder
#================================================================================
use_default_jacorb=1

#================================================================================
# CORBA SECURITY METHOD, only applicable when corba_class=1
#  1 = uses host credential
#  2 = uses stand-alone credential
#================================================================================
security_method=1

#================================================================================
# PATH TO HOST CREDENTIAL
# This file is required when corba_class=1 and security_method=1
# Can be generated by PKS server or found on node (in /c/java/host.p12)
# or found in Ranos (in /etc/opt/ericsson/nms_cif_security/certificates/host.p12 )
# This file has an unlimited lifetime.
#================================================================================
credential=$commonjardir/host.p12

#================================================================================
# PATH TO STAND-ALONE CREDENTIAL and stand-alone password
# This file is required when corba_class=3 (or corba_class=1 and security_method=2)
# Can be downloaded from SLS server or with EMAS.
# This file has a limited lifetime, set by SLS server.
#================================================================================
sa_credential=$HOME/Ericsson/OMSec/sam.p12
#sa_password="oemas"

#================================================================================
# PATH TO STAND-ALONE CREDENTIAL folder
# Used on COM nodes together with the setting xxx to allow the user to choose from a list of sam.p12 files
#================================================================================
sa_folder=$HOME/Ericsson/OMSec

#================================================================================
# PATH TO NETWORK-MODE CREDENTIAL
# The path nm_folder indicates the folder where the NM credential will be downloaded when corba_class=4
# The path nm_credential indicates the path to the NM credential file that will be used when corba_class=5
#================================================================================
nm_folder=$HOME/Ericsson/OMSec
nm_credential=$HOME/Ericsson/OMSec/ssucredentials.xml

#================================================================================
# PATH TO ssucredentials.p12 and Root CA
# These are used with use_tls=31, needed for Cloud RAN
#================================================================================
ca_credential=$HOME/Ericsson/OMSec/CAcert/ssucredentials.p12
ca_rootpem=$HOME/Ericsson/OMSec/CAcert/RootCA.pem

#================================================================================
# URLs and login details for SLS (one or more URLs can be given)
# If the uservariable sls_urls is empty, moshell will try to find it out by http download of the file /configuration/sls_address.cfg
# Only sls_username has a default value, sls_urls and sls_password are not set by default:
#  - when sls_urls is not set, moshell tries to find it out by query to the node (the SLS url is usually set in ManagedElementData)
#  - when sls_password is not set, moshell will prompt for the password. This is more secure than writing the password in a file or on command line
#================================================================================
sls_username=$USER
#sls_password=sls
#sls_urls=https://137.58.194.190:8443/sls/servlet/sls,https://137.58.194.191:8443/sls/servlet/sls

#================================================================================
# The CPP node uses LAAD authentication (default: no)
# When cpplaad=1 (ie the CPP node has local user authorization and authentication database), the ssh/sftp login uses cpp_usernames and cpp_passwords instead of username and ipdatabase password
# Also when cpplaad=1, the following setting apply: smart_password=0
#================================================================================
cpplaad=0

#================================================================================
# Smart cpplaad (0=no, 1=yes):
# automatically change the cpplaad setting to 1 if the node has userAuthenticationAndAuthorization>0. Default=enabled (recommended).
#================================================================================
smart_cpplaad=1

#================================================================================
# The CPP node has Security Level 3 (default: no)
# When sl3=1 (ie the CPP node has security level 3), the ssh/sftp login uses sls_username and sls_password instead of username and ipdatabase password
# Also when sl3=1, the following setting apply: smart_password=0, secure_shell=1, secure_ftp=1.
# If the feature smart_sl3 is activated (see description below), the sl3 setting will automatically change to 1 upon detection of node in security level 3
#================================================================================
sl3=0

#================================================================================
# Smart sl3 (0=no, 1=yes):
# automatically change the sl3 setting to 1 if the node has security level 3. Default=enabled (recommended).
# Note: the sl3 setting will only be changed by smart_sl3 if the node has a connection to OSS.
#================================================================================
smart_sl3=1

#================================================================================
# Dedicated login for CPP Linux nodes (EvoC8300)
#================================================================================
cpplinux_username=root
#cpplinux_password=xxx

#==============================================================================
# Smart Action (0=no, 1=yes).
# To automatically initiate a poll and reload MOs after asynchronous actions on BrM/SwM/CertM/NodeCredential MOs in COM nodes.
# To automatically reload the PmKpi MOs after action "installKpis" in RNC.
# The parameters for the poll can be specified in the uv action_poll_params. 
# The help for these parameters can be found in "h poll". First parameter is the wait time between each poll. Second parameter is the wait time before starting to poll. Third is wait time before checking the result.
#==============================================================================
smart_action=1
action_poll_params=2,5,2

#================================================================================
# Anonymize IMSI/IMEI (0=no, 1=yes)
# Only applicable for the following RNC printouts: te log read, ueregprint, uer
# When anon_ue=1, the user specific part of IMSI/IMEI (MSIN/SNR) will be non-reversibly hashed with CRC32 or MD5 algorithm
#================================================================================
anon_ue=0

#==============================================================================
# Prompt setting:
# It is possible to set the prompt directly at moshell startup with the uservariable "prompt", eg moshell -v prompt=xxx <node>
# Useful for automated test suite such as JCAT.
# The prompt can contain a line feed \n, eg: moshell -v prompt='moshell\nNode' <node>
#==============================================================================
#prompt=XXX

#==============================================================================
# Prompt highlighting and coloring (1=bold/color, 0=normal)
# Prompt highlighting and color can be toggled online using the "b" command.
# Note: prompt_color only works when prompt_highlight is turned on
#
# Prompt color codes:
# grey       : 30 or 100
# red        : 31 or 101
# green      : 32 or 102
# yellow     : 33 or 103
# dark blue  : 34 or 104
# purple     : 35 or 105
# light blue : 36 or 106
# white      : 37 or 107
#
# prompt_attribute: the name of the ManagedElement attribute that will be used to produce the prompt.
# eg: userLabel, site, logicalName...
#
# prompt_case: 0 = all uppercase (default)
#              1 = keep original case (can be mix of upper and lower)
#==============================================================================
prompt_highlight=1
prompt_color=1
prompt_rnc=31
prompt_rbs=32
prompt_mgw=35
prompt_attribute=userLabel
prompt_case=0

#==============================================================================
# Banner text
# To have a customized text that will be printed at moshell/AMOS/EMCLI startup
#  - use_banner: 0/1 . 0=don't print a customized banner (default). 1=print a customized banner
#  - banner_color: 0 for no color, 31 for red, 34 for blue, 35 for purple.
#  - banner_text: the text of the banner. Must be written on a single line, but can use \n to indicate carriage returns.
#==============================================================================
use_banner=0
banner_color=0
#banner_text=\n!!!! This system is private and may only be accessed if authorized. \n!!!! All contents are confidential and proprietary and may not be viewed or used in any way without prior authorization.

#==============================================================================
# Smart Password (0=no, 1=yes, 2=yes but dont display the passwords on screen).
# If password is not found in ipdatabase or in variable $password, we try some standard passwords. Default=disabled (recommended).
# Note: If sl3=1 then smart_password is ignored
#==============================================================================
smart_password=0
standard_passwords=Password4cpp,x,Ericsson_$nodetype,Ericsson_$nodetype$ip,Ericsson_$nodetype$ip2,$nodetype,$nodetype$ip,$nodetype$ip2,Wcdmarbs600!,Wcdmarnc830!,Ericsson_$nodename,rbs1_$nodename,$nodename

#==============================================================================
# Multiple logins
# Try a list of usernames and passwords for:
#  - COM nodes
#  - or CPP Linux (EvoC8300) nodes
#  - or CPP OSE nodes with LAAD (enhanced SL1/SL2, available from C18.Q4)
# The passwords can be stored in encoded format from the "encpw" command
#==============================================================================
#com_usernames=username1,username2,username3,etc
#com_passwords=password1,password2,password3,etc
#cpplinux_usernames=username1,username2,username3,etc
#cpplinux_passwords=password1,password2,password3,etc
#cpp_usernames=username1,username2,username3,etc
#cpp_passwords=password1,password2,password3,etc

#==============================================================================
# Login to CSDP server for gpg decryption
# Should be the user's Ericsson Windows login
#==============================================================================
csdp_username=$USER
#csdp_password=xxx

#==============================================================================
# Password to be used for decryption of .mos command files encrypted with the encpwf command
#==============================================================================
#file_password=xxx

#================================================================================
# Smart corba (0=no, 1=yes):
# automatically change the corba_class setting if mismatch with CorbaSecurity of the node. Default=enabled (recommended).
#================================================================================
smart_corba=1

#================================================================================
# Smart ipv6 (0=no, 1=yes):
# automatically change ipv6 to 1 if attempting to connect to a ipv6 address while ipv6=0. Default=enabled (recommended).
#================================================================================
smart_ipv6=1

#==============================================================================
# Set Window Title at startup (0=no, 1=yes)
#==============================================================================
set_window_title=1

#==============================================================================
# Show colors
# Can be toggled online with the "col" command.
#==============================================================================
show_colors=1

#==============================================================================
# Show userlabel. To show the userlabel in st/pget printouts.
# Can be toggled online with the "ul" command.
#==============================================================================
show_userlabel=0

#==============================================================================
# Show "takes effect". To show the "takes effect" field at the end of successful set command.
# 0=disabled, 1=enabled (default)
#==============================================================================
show_takeseffect=1

#==============================================================================
# PM format in pmx/pmr
# 0=old format (separate days are on separate lines)
# 1=new format (all days on same line)
#==============================================================================
pm_format=1

#==============================================================================
# Alarm format in al/lga/lgx/lgj
# 0=old format (shows the cause)
# 1=new format (shows the additional text)
# 2=new format (shows the additional text and the cause)
#==============================================================================
alarm_format=1

#==============================================================================
# Show updated alarms in alarm log (lga).
# 0=disabled, 1=enabled (default=0)
#==============================================================================
show_updated_alarms=0

#==============================================================================
# Show alarm correlation info in al/lga/lgj (e.g. CI={"C": [{"I": "83b50000-0550-11e8-8e92-98c5dbb749d8","n": "RadioNode"}],"P": "83b50000-0011-11e8-8e92-98c5dbb749d8"})
# 0=disabled, 1=enabled (default=0)
# Only applicable for DUS Gen2
#==============================================================================
show_correlation_info=0

#==============================================================================
# Show alarm userlabel info in al
# 0=disabled, 1=enabled (default=0)
# Only applicable for CPP nodes
#==============================================================================
show_alarm_userlabel=0

#==============================================================================
# Show short duration alarms in lgj (alarms that lasted less than 1 second)
# 0=disabled, 1=enabled (default=1)
#==============================================================================
show_shortduration_alarms=1

#==============================================================================
# Show the isNotified field in al/lga/lge when it is "notified" or only when it is "suppressed"
# 0=disabled, 1=enabled (default=0 : only show when it is "suppressed")
#==============================================================================
show_notified=0

#==============================================================================
# Show information tags allowing to find out to which primary alarm a secondary alarm is related
# 0=disabled, 1=enabled (only show related alarms info), 2=enabled (also show primary/secondary info for alarms without related alarms)
#==============================================================================
show_related_alarms=1

#==============================================================================
# Processing of the lgg printout:
# If enabled, NGR Radio restarts with faultId 0xf06e or 0x998 are combined with the previous restart if has timestamp 2000-01-01 or is within a short time interval before (around 2 minutes)
# More details on the combination triggers are found in the document moshell/examples/misc/V1.3-lg_moshell_modifications.docx
# In addition and once the above combinations are done, multiple consecutive restarts with timestamp 2000-01-01 are replaced with a single restart
#  - lgg_compress: 0=disabled, 1=enabled, 2=same as 1 but without replacing consecutive 2000-01-01 restarts
#  - lgg_intervals=<intervalforcrash>,<intervalforregularrestart>,<intervalforprogramrestart>  (default: 150 seconds interval if the previous restart is a crash, 210 seconds if the previous restart is a regular restart, 30 seconds if a program restart is followed by a board restart)
#  - lgg_showno: 0=dont show the restart Number, 1=show the restart Number (the "No:" field in the llog -l)
#==============================================================================
lgg_compress=1
lgg_intervals=150,210,30
lgg_showno=1

#==============================================================================
# Alarm retry
# Number of attempts to read the alarm list with "al" command when corba connection fails
# Only applicable to CPP nodes
#==============================================================================
al_retry=6

#==============================================================================
# Do "lt root" or "lt all" at startup
# 0=disabled, 1=enabled (default=0)
# Only applicable when connected in interactive mode to a node, not in offline mode nor in batch mode
# If both are set to 1 then "lt all" takes precedence
#==============================================================================
ltall_at_start=0
ltroot_at_start=0

#==============================================================================
# The setting of gs/gsg. For more info see the help of the command "gs"
# 0: gs and gsg disabled
# 1: gs enabled, gsg disabled
# 2: gs disabled, gsg enabled
#==============================================================================
gs_gsg=0

#==============================================================================
# Get format in get <mo> <attr>
# 0=dont show the proxy id
# 1=show the proxy id
#==============================================================================
get_format=0

#==============================================================================
# Moshell alarm
# 0=disabled
# 1=enabled => additional check on CPP feature MOs and TimDevice MOs may print additional alarms in the alarm list.
# These alarms are internally produced by moshell and marked with "Moshell generated alarm"
#==============================================================================
mosalarm=1

#==============================================================================
# Use DBCV
# 0=disabled
# 1=enabled => cvls will show DBC status (OK/NOK/?) and al will raise a "Moshell generated alarm" if some CVs have db inconsistencies
# Refer to "h dbcv" for more info.
#==============================================================================
use_dbcv=0

#==============================================================================
# Sort proxy. To sort the MO proxy list in:
# - 0: proxy order (default)
# - 1: LDN order
# - 2: MO class order
# The "s+/s++/s-" command can be used to switch between the values (s+: 1, s++: 2, s-: 0).
#==============================================================================
sort_proxy=0

#==============================================================================
# Safe syntax. Can also be turned on or off while online with the "safe+/safe-" command.
# Apply strict MO matching rules on MO WRITE commands : bl, deb, del, rdel, fdel, set, eset, rset, fset, acc, facc
# Examples:
# bl utrancell=11 --> will lock cell=11 only (cell=111, or cell=11a , etc. would not be affected)
# bl utrancell=11|utrancell=12|utrancell=13 --> will lock cell=11, cell=12, cell=13
# bl utrancell=11|12|13                     --> same as above
# bl utrancell=11|12|13|iublink=1           --> will lock cell=11/12/13 and iublink=1
#==============================================================================
safe_syntax=0

#==============================================================================
#  Timezone settings: Used by pmx/pmr/lg commands. Example:
#  tz_option=+2 => To set timezone to UTC+2
#  tz_option=-10=> To set timezone to UTC-10
#  Default: not set, i.e. UTC will be used
#==============================================================================
#tz_option=+2

#==============================================================================
# Smart ESI refresh
# When collecting a "refresh" ESI (lg option "-d -2"), this feature checks if there are new crashes on the node, and if not, the ESI collection will be skipped
# 0=disabled (default): refresh ESI is always collected
# 1=enabled : refresh ESI is only collected if there are new crashes on the node
#==============================================================================
smart_refresh_esi=0

#==============================================================================
# Smart XBM handling
# This feature is a wrapper for any MSRBS COLI commands that contain the @<XBM> argument, i.e. the commands listed in the uv xbm_commands below
# It allows to run these XBM-related command with a simplified @<XBM> field: @W (WRAT), @L (LRAT), @N (NR), @A (ALL RATs).
# If a XBM-related command is referring to a non-existing RAT then the command will simply be skipped in order to avoid unnecessary error messages from the node.
# The feature works also when running coli commands via "lh <boardgroup>".
# As is the case with COLI commands handling in moshell, it is possible to run many commands on the same line using semicolon as separator
# If a non XBM-related command (e.g. vii) is executed on the same line then it is simply run transparently.
# If the command contains a reference to a EMCA (e.g. bbEqm00003 , or EMCA3, or just 3) then this argument is replaced by a wildcard "*".
# 
# Possible settings:
#  - smart_xbm=0 (feature is not used, no replacements will be done)
#  - smart_xbm=1 (only replace the XBM argument)
#  - smart_xbm=2 (replace both the XBM and EMCA arguments) -> default
# 
# Examples:
#    - Run the command "bbts tracehitcounter ..." on all XBMs existing in the node , and run the command "mtd debug -ta ..." on the NR XBM of the node (if it exists - otherwise that command is ignored), and run the command "/ppf/getcntrs" 
# >> bbts @A tracehitcounter read * ; mtd @N debug -ta dLL1NRABFPE_ifc_0 -fun getStats();/ppf/getcntrs
#    - Same as above but on all MPs
# >> lh mp bbts @A tracehitcounter read * ; mtd @N debug -ta dLL1NRABFPE_ifc_0 -fun getStats();/ppf/getcntrs   
#==============================================================================
smart_xbm=2
xbm_commands=bbcapi,bbeqm,bbmcs,bbmtdtt,bbps,bbrs,bbte,bbts,bmc,mtd

#==============================================================================
# Smart RCS COLI handling
# In the RCS COLI folder structure there are certain commands that are found under multiple folders
# For instance the ue command, found under /lrat, /rc/nrat, and /rpc/nrat
# With this feature , when the command is given without prefix then it will be replaced by all its existing instances.
# For instance in the case of ue command, all three corresponding commands (/lrat/ue, /rc/nrat/ue, and /rpc/nrat/ue) will be executed when the user runs "ue" without prefix
# This feature works also when running coli commands from "lh <boardgroup>"
#==============================================================================
smart_rcscoli=1
rcscoli_commands=cell,config,control,cstream,f1,getstat,obs,simulatebutton,test_event,timeout,ue

#==============================================================================
# Smart TS handling
# When enabling/disabling T&E CPM traces on the MSRBS Baseband and CPM trace streaming is active, this feature will also enable/disable the traces in the trace streaming session
# I.e. for each te e/d command, an equivalent ts command will be run automatically if CPM trace streaming is active
#==============================================================================
smart_ts=1

#==============================================================================
# From MSRBS 22.Q1 the CPRI hunt paths can be changed after BB/RGW restart or link break
# This feature checks if the lhlist printout has changed and if it has, runs "bor" before lh
#==============================================================================
use_lhlist_check=1

#==============================================================================
# Run top command on COMCLI in RCS nodes
# - 0: run "top" command on COLI (default)
# - 1: run "top" command on COMCLI
#==============================================================================
comcli_rcs_top=0

#===============================================================================
# Check numeric hostname: when the node name consists of a string of digits (eg: 123456789) then a DNS lookup will be done to check whether it points to a valid IP or not
# If this node name is not found in ENM node lookup nor moshell ipdatabase, nor DNS lookup fails, then the IP contact will fail, to avoid trying to connect to a invalid IP
#===============================================================================
check_numeric_hostname=1

#===============================================================================
# Telnet/ssh/ftp/sftp username and maximum number of login attempts (0=unlimited)
#===============================================================================
username=moshelluser
max_login_attempts=0

#===============================================================================
# OSE-shell/ftp security (1 to use ssh/sftp, 0 to use telnet/ftp)
# smart_secure=1 means that if secure_shell=0 and there is no contact to telnet port then secure_shell will automatically change to 1
#===============================================================================
secure_shell=0
secure_ftp=1
smart_secure=1

#===============================================================================
# Use https
# smart_http=1 means that if secure_http=0 and there is no contact to http_port and there is contact to s_http_port then secure_http will automatically change to 1
# Note: smart_http is only applicable for CPP nodes
#===============================================================================
secure_http=0
smart_http=1

#===============================================================================
# http version used in http/https get request
# - 0: http/1.0 , but not fully compatible with the standard, may get discarded by certain firewalls
# - 1: http/1.1 , compatible with the standard
#===============================================================================
http_version=1

#===============================================================================
# Keep file properties at file transfer ftget/ftput (file timestamp and permissions)
# - 0: file properties are not preserved
# - 1: file properties are preserved at ftp "get"
# - 2: file properties are preserved at ftp "put"
# - 3: file properties are preserved at ftp "get" and "put"
#===============================================================================
ftp_preserveprops=0

#===============================================================================
# Control whether the runx command should continue script execution if a MO creation failed due to MO already existing: 1=yes (default). 0=no (legacy)
#===============================================================================
runx_ignore_moexist=1

#===============================================================================
# Timeouts for IP connections (http/telnet/ftp/ssh/sftp/corba), in seconds.
#  * ip_connection_timeout : timeout for connection establishment of telnet/ssh/ftp/sftp/http
#  * ip_inactivity_timeout : timeout for data transfer on telnet/ssh
#  * ftp_timeout           : timeout for data transfer on ftp/sftp
#  * http_timeout          : timeout for data transfer on http
# Following timeouts are only applicable for corba_class >= 2. (for corba_class=1, corba timeout is infinite)
#  * corba_timeout         : timeout for corba requests (MO operations: get/set/create/action/delete)
#  * corba_connection_timeout: timeout for connection establishment on corba
#  * fast_timeout          : timeout used for some operations that should be quick, like fetch iorfile, check mom version, check corba security, sls_urls, etc
#  * medium_timeout        : timeout used for checking the MOM version of the CPP node, over http
#  * use_core_timeout      : enable/disable external timeout control when running coli commands on CPP nodes (default: 300s / disabled by default)
#  * connection_attempts   : the value of the openssh parameter ConnectionAttempts
#===============================================================================
ip_connection_timeout=10
ip_inactivity_timeout=20
ftp_timeout=150
http_timeout=30
corba_timeout=240
corba_connection_timeout=90
fast_timeout=5
medium_timeout=12
use_core_timeout=0
core_timeout=300
connection_attempts=1

#===============================================================================
# Inactivity_timeout (in seconds):
# Moshell exits if no user input arrives within this time.
#===============================================================================
inactivity_timeout=108000

#===============================================================================
# readinput_timeout (in seconds) :
# timeout used for the scripting functions "readinput" and "readinputsilent"
# the function returns the value "TIMEOUT" if no user input is given within this time.
# Default value 0 => same timeout as for moshell prompt (inactivity_timeout)
#===============================================================================
readinput_timeout=0

#==============================================================================
# Keep alive interval (in seconds). Only applicable for CPP nodes.
# A message is sent on the corba interface at this interval to keep the corba connection alive
# Default value 0 means no keep alive message is sent
# Some issue were seen in some labs where corba connection hangs after being left idle for 15-30 minutes
# For these cases, use keepalive_interval=1500 (25 minutes)
# Note: if this setting is used then the inactivity_timeout setting is cancelled and there will be no moshell idle session timeout
#==============================================================================
keepalive_interval=0

#==============================================================================
# Http port: 80 for CPP, xx80 for CppEmu where xx is the offset (usually 40)
# Telnet port: 23 for CPP, xx23 for CppEmu where xx is the offset (usually 40)
# Ftp port: 21 for CPP, xx21 for CppEmu where xx is the offset (usually 40)
# Secure port: used for ssh/sftp. a different value can be used in case of RSG port forwardings
# Corba port: 56834. The port for unsecure corba. Only applicable when corba_orbinit=1 and corba_class=2.
# Secure corba port: 56836. The port for secure corba. Only applicable when corba_orbinit=1 and corba_class>=3.
# Port base: adds a fixed value to each port. E.g: portbase=4000 ==> telnet_port=4023, ftp_port=4021, corba_port=4834, s_corba_port=4836, etc.
#==============================================================================
http_port=80
telnet_port=23
ftp_port=21
secure_port=22
corba_port=56834
s_corba_port=56836
#portbase=4000

#==============================================================================
# Node login: 1 (default): enter a password for ssh/telnet/ftp/sftp.
#             0 : no password. Used for for CPP Backup mode, SimCello/CPPemu, AXE, epic root user
#==============================================================================
node_login=1

#==============================================================================
# Ssh Retry: Number of attempts to retry ssh/sftp login on CPP node when all existing connections are occupied by other users
# The duration between attempts is 1 seconds until the first re-attempt, then 2 seconds until second re-attempt, then 3 seconds until third re-attempt, etc
# Default: 1 retry attempt
#==============================================================================
ssh_retry=1

#==============================================================================
# Http Retry: Number of attempts to retry http file transfer
# The duration between attempts is 1 seconds until the first re-attempt, then 2 seconds until second re-attempt, then 3 seconds until third re-attempt, etc
# Default: 1 retry attempt
#==============================================================================
http_retry=1

#==============================================================================
# Editor to use for the "edit" command (to edit a file on the node)
#==============================================================================
editor=$EDITOR

#==============================================================================
# Files not belonging to a UP that shouldnt be cleaned up by the fclean command
# Separate each file by a comma, as shown below (in this example, target monitor)
#==============================================================================
keepLmList="/d/loadmodules/CXC1326054_R1C01,/d/loadmodules/CXC1326054_R1D01,/c/java/host.p12,/c/java/TaskConfigurationFile.txt,/c/java/OLD_SecurityManagement.prp,/d/loadmodules/CXC33077_R5A08,/c/java/SecurityManagement.prp"

#==============================================================================
# Ask for confirmation on MO commands:
#  - bldebset_confirmation ==> confirmation for the commands bl/deb/set/acc  (0 = no confirmation, 1 = confirmation)
#  - lt_confirmation ==> confirmation for the commands lt/lc  (0 = no confirmation, 1 = confirmation)
#  - del_confirmation ==> confirmation for the commands del/rdel (0 = no confirmation, 1 = confirmation)
# Confirmation is never required when running a command file, regardless of these variables
# Confirmation can be toggled online using command conf[bld]
#==============================================================================
bldebset_confirmation=1
lt_confirmation=1
del_confirmation=1

#==============================================================================
# Restart_confirmation ==> confirmation for node restart ("acc 0 manualrestart" or "restartObj me")
#          *  0 = no confirmation needed
#          *  1 = ask for node type on MGW/RNC/RXI
#          * 11 = ask for node type on MGW/RNC/RXI/RBS
#          *  2 = ask for node type and node name on MGW/RNC/RXI
#          * 22 = ask for node type and node name on MGW/RNC/RXI/RBS
#          *  3 = node restart forbidden on MGW/RNC/RXI
#          * 33 = node restart forbidden on MGW/RNC/RXI/RBS
#==============================================================================
restart_confirmation=1

#==============================================================================
# Polu_confirmupgrade ==> the polu command should or should not automatically send the confirmUpgrade action
#          * -1 = polu will not send the confirmUpgrade action
#          *  0 = polu will not send the confirmUpgrade unless run from a moshell script
#          *  1 = polu will send the confirmUpgrade action (default value)
#==============================================================================
polu_confirmupgrade=1

#===============================================================================
# List of xml files to search for in http://<node>/cello/oe/xml
# The files will be searched in the same order as displayed in the list, eg:
# rnc_node_mim.xml, then RbsNode.xml, then CelloMOM.xml
# for using mgw complete mom, add: mmgw_node_mom_complete.xml,mmgwr4_node_mom_hidden.xml
#===============================================================================
xmlmomlist="rnc_node_mim.xml,RbsNodeVersion.txt,RbsNode.xml,mmgw_node_mom_limited.xml,RxiNode.xml,mmgwr4_node_mom_open.xml,mgw_node_mom_ro.xml,CelloMOMRbs.xml,CelloMOM.xml"

#==============================================================================
# Show timestamp in printout headers (0 = no timestamp, 1 = timestamp in local time, 2= timestamp in local time followed by timezone indication ) 
# Show Node IP in printout headers (0 = show node name, 1 = show node ip)
#==============================================================================
show_timestamp=1
show_nodeip=1

#===============================================================================
# Transaction timeout: timeout in seconds for MO operations that require a transaction (set/create/delete/action).
# Only applicable for corba_class >= 2 (for corba_class=1, it is hardcoded to 3600)
#===============================================================================
transaction_timeout=180

#===============================================================================
# Transaction size: this is used by the command "u!!" only
# It controls how many MO operations are placed in between the transaction tags when generating a .mo file
# For more info check the help of the "u!!" command
# Warning: not recommended to raise this value for safety reasons.
#===============================================================================
transaction_size=300

#==============================================================================
# Fast_lh, fast_lhz, fast_cab, fast_coli, fast_sql:
# The lh, lhz, cab, and coli commands are made faster by running a command file directly on the node with "shell -f".
# The fro command is made faster by running a command file directly on the node with "sql include".
# The command file is then removed from the node after completion.
# The lh/lhz/cab/fro/coli commands will only use ftp if :
#     - more than <fast_xxx_threshold> commands have to be sent (in case of lh/lhz/coli command)
# (This depends on the number of boards in the board group and the number of commands to be sent to each board.)
#     - more than <fast_cab_threshold> boards exist in the node (in case of "cab" command)
# Example: suppose there are 2 boards in the board group called "tub", and fast_lh_threshold=5
#          if you do "lh tub vii" then it wont use fast_lh since only 2 commands have to be sent.
#          but if you do "lh tub vii ; llog ; vols" then it will use fast_lh since 2x3=6 commands have to be sent.
# In the case of coli commands, the printout sometimes is corrupted by spurious echo characters.
# The workaround in this case is to set fast_coli_threshold to 0 prior to running the command.
# Caution: if fast_coli_threshold is too low then some commands will not work, e.g. cmxbsh, npsh, ncli, ...
#==============================================================================
fast_lh_threshold=5
fast_cab_threshold=5
fast_coli_threshold=30
fast_sql_threshold=5
fast_lhz_threshold=0

#==============================================================================
# use_dbdump
# Only applicable for CPP OSE Nodes C20.Q1 or higher (works on older CPP from 18.Q2 but with some issues)
# Specify whether the dbc/dbd/dbcv command will :
#  0: analyse db.dat files (legacy behaviour) or
#  1: analyse dbdump.zip files (taken with MO action ConfigurationVersion.generateDbDump or command "cvgetd")
# The latter does not require Polyview
#==============================================================================
use_dbdump=1

#==============================================================================
# mibmgr_threshold
# The number of MO instances above which the dcg command will use MibManager for collecting the MO dump
# Only applicable for CPP nodes >= C15.1
# Example mibmgr_threshold=120000 means that the MibManager will be used for collecting MO dump containing 120,000 MO instances or more
# Mostly useful on O&M connection with low bandwidth or high latency, or for nodes with very many MO instances.
# mibmgr_threshold=0 means the MibManager will not be used.
#==============================================================================
mibmgr_threshold=120000

#==============================================================================
# use_lhz : whether to transfer COLI printouts in compressed format or not
# - 0: disabled completely, including the lhz command will behave as lh
# - 1: enabled only for the lhz command
# - 2: also enabled for ced, cedh, lgt, lh <group> te log read
# - 3: also enabled for uer, stda, sti (NOT recommended yet, slower in most cases)
#==============================================================================
use_lhz=2

#==============================================================================
# use_lhv : whether the lhsh command will be sent with the -v option
# - 0: disabled => lhsh command is sent transparently as the user typed it
# - 1: enabled  => lhsh command is sent with -v option in order to find the end of the printout from the return code instead of using echo command. Useful for XMU03 and avoiding spurious echo printout
# Default: 1 (recommended)
#==============================================================================
use_lhv=1

#==============================================================================
# use_bocache : to read board group configuration from cache
# - 0: disabled. Board group configuration is always read from the node
# - 1: enabled. Baord group is read from cache. Do not use in live network, only for lab and internal usage.
# bocachedir: the path to the directory containing the bocache files. This is optional. Default location is $logdir/cache
# bocachename: the basename of the cache files. This is optional. Default basename will be the node ipaddress
# The names of the cache files will be <bocachename>.<extension> , where <bocachename> is by default the ipaddress and the extensions are: .bo/.rnc/.cpp/.drh
# These files are generated automatically when running the "bor" command and stored in bocachedir
#==============================================================================
use_bocache=0
#bocachedir=/path/to/bocachedirectory
#bocachename=hello

#==============================================================================
# print_lmids: 0=no loadmodule name translation in COLI commands
#              1(or more)=append loadmodule name translation in COLI commands and pipe "te log read" to concat_segmented_rlib_traces.pl (RNC)
#==============================================================================
print_lmid=1

#==============================================================================
# Settings for the RNC/RBS/MGW/CPP/LTE complete MOM
# The complete MOM is for internal use only, do NOT distribute to customer.
# If use_complete_mom=1 then moshell will try to find the corresponding complete mom in moshell/jarxml
# If not found there, it will try and fetch it :
#   1) from clearcase (if there is clearcase access and correct labels in config spec: /main/wendy/LATEST , /main/wanja/LATEST, D2-STRUCT_MAIN_RNC_INC2.1_KI)
#   2) from utran01 server (if there is contact to utran01)
# If use_complete_mom=2 then moshell will only try to look in the moshell/jarxml folder and not try to fetch the file from utran01
#==============================================================================
use_complete_mom=0

#==============================================================================
# When use_extended_mom=1, some additional attributes are displayed in the get/kget/hget commands.
# The list of extended attributes can be found in the file moshell/commonjars/extendedMOM.txt
# It is also possible to print these attributes with the command "eget", regardless of the use_extended_mom setting
#==============================================================================
use_extended_mom=0

#==============================================================================
# Append the enum translation in attributes of type sequence of enums in get commands (get/hget/kget/etc)
# Append the binary to decimal or decimbal to binary conversion for struct members sfAllocationFourFrame/sfAllocationOneFrame or subframeAllocationFourFrame/subframeAllocationOneFrame
# Default value is 1 (ON) but for backwards compatibility to older moshell printout format (e.g. scripts), it is possible to use 0 (OFF)
#==============================================================================
translate_sequence_enum=1

#==============================================================================
# Use_crn: 0: disabled, 1: enabled (default)
# When set to 1, the commandfile generated by diff/undo/gmc will use the command "crn" instead of "cr"
# The uv no_crn is to list MO classes for which use_crn will always be 0
#==============================================================================
use_crn=1
no_crn=RbsLocalCell,Carrier

#==============================================================================
# Use_nodelete: 0: disabled, 1: enabled (default)
# When set to 1, the del/rdel command will not delete any MO instances of the types listed in "nodelete_list"
#==============================================================================
use_nodelete=1
nodelete_list=Program,ReliableProgramUniter,RncModule,Aal2Sp,SwAllocation,TimDevice,EthernetSwitchingAdm,CchFrameSynch,DchFrameSynch,LinkTransmissionProfile,SduFormat,Subflow,UeRabType,UeRc,UeRcEdchFlow,UeRcEdchGainFactors,UeRcHsdsch,UeRcPhyChDl,UeRcPhyChEdch,UeRcPhyChUl,UeRcRab,UeRcRb,UeRcRbRlc,UeRcTrCh,UeRrcType,PiuDevice

#==============================================================================
# Use_nolock: 0: disabled, 1: enabled (default)
# When set to 1, the bl/set command will not lock any MO instances of the types listed in "nolock_list"
# Note: if a MO class has the prefix "Com" then it will be applicable to COM nodes only.
#       if a MO class has the prefix "Cpp" then it will be applicable to CPP nodes only.
#       without prefix, the MO class will be applicable to both platforms
#==============================================================================
use_nolock=1
nolock_list=Com.EthernetPort

#==============================================================================
# Use_noset: 0: disabled(default), 1: enabled
# When set to 1, the set command will reject setting the attribute if it is part of the "noset_list".
# Note: if a MO class has the prefix "Com" then it will be applicable to COM nodes only.
#       if a MO class has the prefix "Cpp" then it will be applicable to CPP nodes only.
#       without prefix, the MO class will be applicable to both platforms
#==============================================================================
use_noset=0
#noset_list=Com.NodeBSectorCarrier.configuredMaxTxPower,SectorCarrier.configuredMaxTxPower

#==============================================================================
# Use_nosetmany: 0: disabled, 1: enabled (default)
# When set to 1, the set command will only allow to set the attributes of "nosetmany_list" on one MO instance at a time
#==============================================================================
use_nosetmany=1
nosetmany_list=remoteCpIpAddress1,remoteCpIpAddress2

#==============================================================================
# To specify whether the Market Name (eg BB5216, BB6630) or the Product Name (DUS52, DUS53) will be shown 
# 0= show product name, not market name
# 1= show market name except for RG R609 (LC-05 9xCPRI)
# 2= show market name for all boards
#==============================================================================
use_market_name=1

#==============================================================================
# Specify whether pmr/pmx shall automatically obtain the list of supported compressed pdf counters 
# 0=disabled
# 1=enabled 
# 2=same as 1 but in addition, formulas that are not applicable to the MO instance are excluded from pmxe printout
#==============================================================================
use_pmvalidate=2

#==============================================================================
# In this variable you can define a different path for the pm ROP files:
# statistics (.xml.gz), ctr/uetr (.bin), gpeh (.lnk)
# If the variable is not defined, the files are stored under the standard
# logfiles directory: ~/moshell_logfiles/logs_moshell
#==============================================================================
#pm_logdir=/path/to/pm_logdir

#==============================================================================
# Path to UTRAN decoder (decoder.pl) and LTE decoder (ltedecoder), used by the "pme" command (option "d")
#==============================================================================
decoder=/app/decoder/0/bin/decoder.pl
ltedecoder=/app/moshell/bin/ltng-decoder

#==============================================================================
# Path to expect, needed for the goxb command
#==============================================================================
expect=/usr/bin/expect

#==============================================================================
# Path to python, needed for the rinpm command
#==============================================================================
python=python

#==============================================================================
# Path to python3, needed for the trg command
#==============================================================================
python3=python3

#==============================================================================
# The default mute factor, controls the amount of progress dots in l+m/l+mm
#==============================================================================
muteFactor=100

#==============================================================================
# The default wait time (in seconds) when checking PM counters increments (stc and pdiff commands)
#==============================================================================
pm_wait=30

#==============================================================================
# The default ROP period (in minutes) for the wait command (eg: wait 1r)
#==============================================================================
rop_period=15

#==============================================================================
# Include non-pm attributes in statistics scanners
# Only works for MO classes using the pull method (ie. where counters are not reset at the end of the ROP)
# and attribute has to be of type long, long[], boolean, string, moRef
# Default is 0 (disabled). Set to 1 in order to activate this functionality.
#==============================================================================
include_nonpm=0

#==============================================================================
# Moshell Command logging (0=disabled, 1=enabled)
# By default, all moshell commands run on a particular node are logged under:
#    /home/<userid>/moshell_logfiles/logs_moshell/moscomlogs/ipaddress.log
# To keep the command logs in a different folder, set the uservariable moscommanddir in the moshellrc or .moshellrc file
# Eg: moscommanddir=/opt/ericsson  --> the logs will end up under /opt/ericsson/moscomlogs/<userid>/<ipaddress>.log
#==============================================================================
moscommandlog=1
#moscommanddir=/path/to/moscomlogs

#==============================================================================
# Moshell Command log rotation
# When the moshell command log is above a certain size (default: 10 MB) then it is moved to a file called <ipaddress>.old.gz
# The contents of the file <ipaddress>.old.gz however stays available for the lgn command to display.
# To disable moshell command log rotation, set the uv moscommandsize to 0
#==============================================================================
moscommandsize=10

#==============================================================================
# Keep command history between different sessions to the same node
# Specifies the number of lines of command history that get carried across from the moshell command log of previous sessions to a specific node
# This feature requires moscommandlog=1. To disable the feature, set keep_history_lines to 0
# Note: keep_history_lines also controls how many commands it is possible to call from the history with "arrow-up" and "arrow-down"
#==============================================================================
keep_history_lines=100

#==============================================================================
# Consistency check on the Set command against the recommended value
#          *  0 = no parameter consistency check is done before performing a set operation
#          *  1 = Prints an extra warning on the set command when trying to set an attribute to a value different to the recommended value
#          *  2 = Same as 1, and an exception is given when trying to set an Ericsson Internal parameter to a value different than the recommended value. The list of Ericsson Internal parameters can be printed from the complete MOM with command "momd . . . ericsson"
# The recommended values are stored in the files moshell/commonjars/pm/PARAM* and depend on the node type and SW release
# Additional recommended values can be stored in the file specified in the uservariable custom_param_file
#==============================================================================
set_check=1

#==============================================================================
# Consistency check on the Set command against the attribute flag (key, restricted, readOnly)
#          *  0 = no check is done and the attribute is always attempted to set despite being key/restricted/readOnly => the node will throw the exception
#          *  1 = an exception is produced internally by moshell so the attribute is not attempted to set on the node
#==============================================================================
set_checkflag=1

#==============================================================================
# Path to reference file containing parameter reference values
# These reference values complement or override the Ericsson recommended parameter values listed in the files moshell/commonjars/pm/PARAM*
# The custom_param_file should only contain reference values that are different to the Ericsson recommended values
# The format of the custom_param_file must be the same as the format used by the PARAM files
# The values in this file are used when :
#    - running a parameter audit with the diff command, e.g. "diff <mo-filter>" or "diff <modump>"
#    - running the set command if set_check=1
# By default, this uservariable is not set.
# Note: it is possible to specify several files, in which case they are read in sequential order and the settings in the latter files
#       will override the ones in the former. Eg: custom_param_file=/path/to/file_one,/path/to/file_two,/path/to/file_three
#==============================================================================
#custom_param_file=/path/to/custom_param_file

#==============================================================================
# Path to alternative upids.txt files to complement or override the UP translations of moshell/commonjars/upids.txt
# (used in SW release translation of cvcu/cvls and upid commands).
# The default upids.txt file is stored in moshell/commonjars/upids.txt and contains the release names for all the RNC/RBS/ERBS/RXI UpgradePackages
# If this file is not up to date, it is possible to override or complement it by manually storing additional entries in a file whose path shall be specified in the uservariable custom_upid_file
# The format for each entry in this file shall be the same format as in moshell/commonjars/upids.txt, ie:
# ReleaseName; CPPversion; UP ProductNumber; Up Revision; Node Type
# for instance: L12A.1.6.0; EP22-1-C12.0; CXP102051/14; R21DD; ERBS
# Note: it is possible to specify several files, in which case they are read in sequential order and the entries in the latter files
#       will override the ones in the former. Eg: custom_upid_file=/path/to/file_one,/path/to/file_two,/path/to/file_three
#==============================================================================
#custom_upid_file=/path/to/custom_upids.txt

#==============================================================================
# MO classes and attributes to exclude from the comparison in "diffm"/"diffd" commands. 
# Any MO classes/attributes included in these lists will be skipped only in regard to the default value comparison. 
# If there is a recommended value in the PARAM file or reference file then this check will not be excluded.
#==============================================================================
diffm_exclude_moclasses=LoadModule,Program,ReliableProgramUniter,UpgradePackage
diffm_exclude_attributes=administrativeState,user,password,userLabel,remoteSctpPortNbapC,remoteSctpPortNbapD,selectionPriority,egressAtmMcr,ingressAtmMcr,egressAtmPcr,ingressAtmPcr,ipAddress,ipAddress1,ipAddress2,ownIpAddressActive,ownIpAddressPassive,piuGroupNumber,upgradeGroupId,radioBuildingBlock,alarmStatus
diffm_exclude_structs=PlmnIdentity,BoardTypePositions

#==============================================================================
# MO classes and attributes to exclude from the comparison in "diffo" command
#==============================================================================
diffo_exclude_moclasses=Program,LoadModule,RcsPm.PmGroup,RcsPm.MeasurementReader
diffo_exclude_attributes=userLabel

#==============================================================================
# MO attributes to exclude from the comparison in "dbd" command
#==============================================================================
#dbd_exclude_moclass=Program,LoadModule,MsProgram
#dbd_exclude_attributes=maoTableIndex,froTableIndex,theclientsuniqueid

#==============================================================================
# In case only certain MO classes shall be checked by the "dbd" command
#==============================================================================
#dbd_only_moclasses=Program,ReliableProgramUniter,LoadModule

#==============================================================================
# Cluster Members: the list of nodes that are part of the same cluster
# Usually this uservariable is node specific and therefore shall be specified in the ipdatabase file or from within the moshell session with uv command
# The list of cluster members is currently used in the moshell command "ir" (rnc in pool iub redundancy)
# The nodes can be specified in any of the following way:
#   - nodename
#   - dnsname
#   - ipaddress
#   - ipaddress:portbase  (in case of EriEmu)
#   - /path/to/modump.zip (in case of offline mode)
#==============================================================================
#cluster_members=<node1>,<node2>,....

#==============================================================================
# ir_nosync: the list of attributes that shall not be synchronised from primary to secondary Iublink (RNC in pool with Iub redundancy)
#==============================================================================
ir_nosync=administrativeState,rncModulePreferredRef,userPlaneIpResourceRef

#===============================================================================
# Password encoding type: controls the type of password encoding produced by the "encpw" command
# - 0: the legacy encoding, starts with the string "ENC?:" , backward compatible with all moshell versions
# - 1: the new encoding, starts with the string "ENC@:", supported from moshell version 21J
#===============================================================================
encpw_type=1

#===============================================================================
# Enable/disable the use of curl for HTTPS transfer on RCS nodes (0=disabled, 1=enabled)
# Enabled: use curl for HTTPS transfer
# Disabled: use openssl for HTTPS transfer
#===============================================================================
use_curl=1

#===============================================================================
# Enable/disable the use of built-in ip connection utility (0=disabled, 1=enabled)
# Enabled: an internal ping utility is used to check ip contact with the node
# Disabled: an external ping utility is used which makes moshell response time a bit slower
#===============================================================================
use_netcatlib=1

#===============================================================================
# Enable/disable the use of built-in scandir utility (0=disabled, 1=enabled)
# Enabled: an internal utility to list directory contents is used
# Disabled: directories are read via "ls -1", slightly slower
# Default=enabled, except for solaris/sparc
#===============================================================================
use_scandir=1

#===============================================================================
# Enable/disable the use of 64bit binaries for ssh/sftp on linux x86_64
# Default=enabled
#===============================================================================
use_lin64=1

#===============================================================================
# Support for IPv6 (0=disabled, 1=enabled)
# When IPv6 support is enabled it is possible to connect to a CPP node using an IPv6 O&M address
# Limitations: ftp is not yet supported, use_netcatlib disabled (==> commands will have slower response time)
#===============================================================================
ipv6=0

#===============================================================================
# Choice of TCP monitor client for IPv4 CPP nodes ("mon" command)
# use_monitor6054=1 -> use monitor6054
# use_monitor6054=0 -> use nc6
#===============================================================================
use_monitor6054=0

#===============================================================================
# Support for Transport Nodes
# rcli=1 : SIU-02, TCU-02, ESC. Also Router6000 older than 21.Q4 (from 21.Q4, use comcli=35)
# rcli=2 : Mini-Link
#===============================================================================
rcli=0

#===============================================================================
# TRG search count
# the number of search results that will be returned when executing the command: trg -s "search string"
# 0 means that the search count will not be specified so the default value of 10 results will be used in TRGenerator
#===============================================================================
trg_search_count=0

#===============================================================================
# SDI thresholds
# sdi_fibercheck_maxloss: the maximum expected length for fibers between DU and RRU (typically less than 300 meters)
# sdi_fibercheck_maxloss: the maximum expected loss for those fibers (typically should be less than 6 dB)
#===============================================================================
sdi_fibercheck_maxlength=300
sdi_fibercheck_maxloss=6

#===============================================================================
# Support for YANG nodes
#  - yangcli=1 means that the node will be accessed via yang. It is also possible to use "-z" option. 
# Note that by default YANG nodes are accessed in multi-mode
#  - netconfyang_port   : the port used for accessing the netconfyang SSH interface
#  - s_netconfyang_port : the port used for accessing the netconfyang TLS interface
#  - yang_username/yang_password : the login for the netconfyang SSH interface
#  - yang_inactivity_timeout : the idle timeout of the netconfyang SSH/TLS session. The SSH/TLS session is closed if no user activity for this time period
#  - yang_read_timeout : the timeout of the netconfyang SSH/TLS session when reading output from the node. If a response is taking longer than this timeout then the client will stop waiting for the response and return an exception
#  - yang_connection_timeout : the timeout when establishing SSH/TLS connection to the node.
#  - use_yangltfilter=0/1      : to filter out certain MO classes from the "lt all" printout
#  - yang_ltfilter=<moclasses>  : the list of MO classes to filter out from the "lt all" printout
#  - yang_struct=0/1   : to display certain MO classes as struct attributes (progess-report, administrative-data...)
#  - yang_sftp_servers=Default,Server1,Server2,....     : the list of sftp-server MOs
#  - yang_sftp_passwords=password,password1,password2,....   : the password corresponding to the username specified in endpoint MO under each respective sftp-server MO
#  - snmp_username: the username for the SNMP connection, used to read the list of active alarms
#  - snmp_sha_password / snmp_aes_password: the SHA and AES password used for fetching active alarms over SNMP with AuthPriv security
#  - snmp_authpriv: 0=only try with noAuthNoPriv. 1=only try with AuthPriv. 2=try first with noAuthNoPriv and if that does not work, try with authPriv (default)
#  - yang_pget_method: 0=try first via CMYP (ssh port 22) and if blocked try via netconf (default). 1=only try via netconf (only for testing during interim time while both methods are available)
#  - yang_enable_oru: 0=no support for O-Radio (default). 1=support for O-Radio (slower connection time)
#===============================================================================
yangcli=0
netconfyang_port=830
s_netconfyang_port=6513
yang_username=moshelluser
#yang_password=xxx
yang_inactivity_timeout=120
yang_read_timeout=60
yang_connection_timeout=10
use_yangltfilter=1
yangltfilter=PmThresholdMonitoring
yangftp_port=9022
s_yangftp_port=9021
use_yangstruct=1
snmp_username=user1
snmp_port=161
snmp_sha_password=snmppass1
snmp_aes_password=snmppass1
snmp_authpriv=2
yang_pget_method=0
yang_enable_oru=0
#yang_sftp_servers=Default
#yang_sftp_passwords=secret
   

#===============================================================================
# Support for COM nodes
#
# smart_comcli=1   means that the comcli value will be set automatically and does not need to be specified manually
# comcli=0 (default, CPP node)
# comcli=1 (COM node, accessing the Linux shell)
# comcli=2 (COM node, accessing the COM CLI shell)
# linux_shell=1 means that the linux shell is available on this node
#    -> The COMCLI will be accessed by executing the cliss application in the linux shell. The cliss path can be specified in the uservariable cliss.
#    -> If the CLISS command contains a space then use comma instead of the space (eg: instead of "/home/comuser/bin/cliss 2843", write "/home/comuser/bin/cliss,2843")
# linux_shell=2 is the same as linux_shell=1 except that the bash shell of the node is started in a different way, needed in some cases for picoRBS.
# linux_shell=0 means that the linux shell is not available on this node, eg. RBS G2.
#    -> The COMCLI will be accessed via a separate port specified in comcli_port
#    -> The COLI shell will be accessed via the port specified in secure_port
#    -> The SFTP server of the node will be accessed via the port specified in ftp_port. On RBS G2 this is port 2024
# comcli_columns is the maximum number of characters that can be displayed per line
# comcli_timeout is the idle timeout in seconds for the ssh session used for the MO interface to COM. It is also the timeout after which a hanging MO printout will be released. Default value is 2 minutes.
# netconf_timeout is the idle timeout in seconds for the ssh session used when running a netconf script with the moshell command "netconf".
# comcli_cfg is the default path for the com.cfg file
# comcli_model is the default path for the the model_file_list.cfg
# comcli_retry_maxtime is the maximum time that moshell during which moshell will retry connecting to COMCLI. Set to 0 to disable auto-retry.
# comcli_retry_interval is the interval between each retry
# comcli_momretry_maxtime is the maximum time that moshell during which moshell will retry downloading the file /models/index.html. Set to 0 to disable auto-retry.
# comcli_momretry_interval is the interval between each retry
# comcli_port is the TCP port to be used for accessing the COMCLI over SSH when linux_shell=0
# s_comcli_port is the TCP port for accessing COMCLI over SSL/TLS
# s_secure_port is the TCP port for accessing RCS-COLI over SSL/TLS
# s_http_port is the TCP port for HTTP over SSL/TLS (HTTPS)
# comcli_mom is the method for mom fetching:
#    -> -1: via coli shell command "cat" if linux_shell=0
#           via linux shell command "cat" if linux_shell>0
#    ->  0: via coli shell command "cat" if linux_shell=0
#           via sftp if linux_shell>0
#    ->  1: with Schema MO and sftp. The uv comcli_mompath specifies where on the node the MOM fragments can be fetched. On real pico it is /oss/models, on netsim pico it is /SysMMimSchemas
#    ->  2: with Schema MO and http or https
#    ->  3: with Schema MO export action. The uv export_method specifies whether to use a local SFTP server or a remote SFTP server, see further down, export related uv's.
# comcli_mompath is the path on the node where the MOM fragments can be fetched via sftp and is only applicable for comcli_mom=1
# comcli_portfile indicates whether the TCP ports should be read from the file cat /local/scratch/$USER/RCS_ROOT/$HOME/releases/R*/port.conf (0=no, 1=yes) -> Use 1 for RCSsim only.
# login_wait: time to wait in ms before sending ssh commands after login. May be needed for pico to avoid hanging. Only applies when linux_shell=2 or node_login=0
# comcli_ropdir: the path where the ropfiles are stored. Normally this is checked automatically from the attribute PmMeasurementCapabilities::fileLocation but can be bypassed with this uservariable
# comcli_ropdate: read the current date of the node via the "date" command on the linux shell. Default 0 except on nodes like BGF
#
# Saved Login for COM nodes:
# The login for COM nodes can be saved in the uservariables com_username and com_password.
# If the uservariable com_password is empty then the login will be read from the uservariable username and the variable $password
#
# Connection methods:
#   - use_netconf=0  -> the MO interface is accessed via COMCLI (over SSH or TLS)
#   - use_netconf=1  -> the MO interface is accessed via NETCONF over SSH instead of COMCLI
#   - use_tls=0      -> the COMCLI and RCS-COLI are accessed via SSH with username/password login.
#   - use_tls=1      -> the COMCLI and RCS-COLI are accessed via TLS, using a sam.p12 credential file. The uservariables sa_credential and sa_password must be set.
#   - use_tls=2      -> the COMCLI and RCS-COLI are accessed via TLS, using a client.pem and ca.pem file. The uservariables clientpem and capem must be set.
#   - use_tls=21     -> same as us_tls=2 but with an additional key.pem file and its passphrase. The uservariables keypem and keypass must be set, in addition to the variables clientpem and capem.
#   - use_tls=3      -> the COMCLI and RCS-COLI are accessed via TLS, using a ssucredentials.xml file. The uservariable nm_credential must be set.
#   - tls_menu=1     -> a menu allows the user to select connection method TLS with ssucredential.xml/sam.p12 or SSH with user/password. The credential files will be searched in the folders nm_folder and sa_folder (default: ~/Ericsson/OMSec)
#
# Faster MO write operations (TR HU50440)
#   - comcli_netconf_set (0/1) -> the set/bl/deb commands are performed via NETCONF instead of COMCLI . Currently default ON in DUS Gen2 and OFF in other node types.
#   - comcli_netconf_del (0/1) -> the del/rdel commands are performed via NETCONF instead of COMCLI . Currently default ON in DUS Gen2 and OFF in other node types.
#   - comcli_netconf_cre (0/1) -> the cr/crn commands are performed via NETCONF instead of COMCLI . Currently default ON in DUS Gen2 and OFF in other node types.
#   - comcli_netconf_pcr (0/1) -> the pcr commands are performed via NETCONF instead of COMCLI . Currently default ON in DUS Gen2 and OFF in other node types.
#   - comcli_netconf_acc (0/1) -> the acc commands are performed via NETCONF instead of COMCLI . Currently default ON in DUS Gen2 and OFF in other node types.
#
# Node Credential validation:
#   - nc_validate    -> whether to do Node Credential validation for the TLS ports (0=no , 1=yes)
#   - ca_folder      -> the folder containing root CA files fetched from TDPS server, used for NC validation of the TLS ports
#
# Shell handling
#   - smart_shell=1  -> auto-detect to which shell to send a command: COMCLI, COLI, Linux. Type "h c+" for info
#
# ESCI (Ericsson Support Command Interface)
#   - esci=1         -> a prompt and disclaimer will be printed before executing a command that requires COLI access
#
# Number of BB crash dumps to keep in the ESI
#   - esi_nr_bbdumpkeep=2  -> by default only the last 2 BB crash dumps of each BB EMCA processor will be included in the ESI (when taken with lgf/dcgm), the other ones will be removed
#-------------------------------------------------------------------------------
#           COMCLI special values.
#
# The following values of the comcli uservariable can be used
# for the following node types and automatically will set a number of other settings in order to work on those node types:
# VALUE        NODE TYPE                     CORRESPONDS TO:
# comcli=10    pico commercial               comcli=2,linux_shell=0,comcli_mom=1,comcli_port=9830,secure_port=9830,ftp_port=22
# comcli=11    pico RnD                      comcli=1,cliss=/opt/com/bin/cliss,9892,comcli_cfg=/opt/com/etc/local/maf.cfg
# comcli=12    NetSim and APG43L 1.x         comcli=2,linux_shell=0,comcli_mom=1,comcli_port=22,secure_port=22,ftp_port=22,comcli_mompath="/SysMMimSchemas"
# comcli=13    pico commercial via netconf   comcli=2,linux_shell=0,comcli_mom=1,comcli_port=9830,secure_port=9830,ftp_port=22,use_netconf=1,netconf_port=830
# comcli=20    g2 via comcli/SSH             comcli=2,coli_shell=1,comcli_mom=2,http_port=8080,secure_port=4192,linux_shell=0,ftp_port=2024,secure_http=1,comcli_port=2023,s_http_port=443
# comcli=21    g2 RnD via comcli/SSH         comcli=2,coli_shell=2,comcli_mom=2,http_port=8080,secure_port=4192,linux_shell=0,ftp_port=2024,secure_http=1,comcli_port=2023,s_http_port=443
# comcli=22    g2 RCSsim via comcli/SSH      comcli=2,comcli_mom=2,comcli_portfile=1
# comcli=23    g2 commercial via netconf/SSH comcli=2,comcli_mom=2,http_port=8080,secure_port=4192,linux_shell=0,ftp_port=2024,use_netconf=1,netconf_port=830
# comcli=24    g2 RnD via netconf/SSH        comcli=2,comcli_mom=2,http_port=8080,secure_port=4192,linux_shell=0,ftp_port=2024,use_netconf=1,netconf_port=830
# comcli=25    g2 via comcli/TLS + sam.p12   comcli=20,use_tls=1
# comcli=26    g2 via comcli/TLS + pemfiles  (client.pem, ca.pem) comcli=20,use_tls=2
# comcli=27    g2 via comcli/TLS + ssucredentials           comcli=20,use_tls=3
# comcli=28    g2 via comcli/TLS+SSH with connection menu   comcli=20,tls_menu=1,use_tls=-1
# comcli=29    g2 via comcli/TLS+SSH + pemfiles and key password (client.pem, ca.pem, key.pem, keypassword)  comcli=20,use_tls=21
# comcli=30    NetSim                        comcli=2,comcli_mom=3,linux_shell=0,comcli_port=22,secure_port=22,ftp_port=22,export_method=1
# comcli=31    BSP                           comcli=2,comcli_mom=3,linux_shell=0,comcli_port=2024,secure_port=2024,ftp_port=22,export_method=1
# comcli=32    PGM                           comcli=2,secure_port=830
# comcli=33    Netsim via netconf            comcli=2,comcli_mom=3,linux_shell=0,comcli_port=22,secure_port=22,ftp_port=22,export_method=1,use_netconf=1,netconf_port=830
# comcli=34    APG43L 2.x                    comcli=2,comcli_mom=3,linux_shell=0,comcli_port=22,secure_port=22,ftp_port=22,export_method=1
# comcli=35    Router6000                    comcli=34,epg_ssr=1
# comcli=36    EMe,vSAPC                     comcli=30,ftp_port=22,comcli_port=830,ssh_subsystem=cli,export_method=3
# comcli=37    MRSv,vSAPC,DSC,HSSFE<1.31     comcli=36,ftp_port=115
# comcli=38    CBA Ref                       comcli=36,ftp_port=830
# comcli=39    vSBG                          comcli=36,ftp_port=2028,comcli_port=2022
# comcli=40    vEME                          comcli=36,comcli_port=2022
# comcli=41    vBGF,vSBC                     comcli=37,linux_shell=1,secure_port=22,ssh_subsystem=,comcli_ropdate=1,comcli_ropdir=/var/filem/nbi_root/PerformanceManagementReportFiles
# comcli=42    MTAS,CSCF                     comcli=37,linux_shell=1,secure_port=22,ssh_subsystem=,ftp_port=830,comcli_ropdate=1,comcli_ropdir=/var/filem/nbi_root/PerformanceManagementReportFiles
# comcli=43    HSSFE>1.31                    comcli=37,secure_port=122,comcli_port=122,ssh_subsystem=
# comcli=5*    5G VNFM                       comcli=2*,s_http_port=3443
#===============================================================================
comcli=0
linux_shell=2
cliss="/opt/com/bin/cliss"
comcli_columns=3000
comcli_timeout=120
comcli_cfg=/opt/com/etc/com.cfg
comcli_model=/opt/com/etc/model/model_file_list.cfg
comcli_retry_maxtime=1200
comcli_retry_interval=5
comcli_port=22
comcli_mom=-1
comcli_mompath=/oss/models
comcli_momversion_cache=1
comcli_momretry_maxtime=60
comcli_momretry_interval=5
comcli_portfile=0
comcli_portfilepath=/local/scratch/$USER/RCS_ROOT/home/$USER/releases/*/port.conf
login_wait=500
use_netconf=0
netconf_port=830
smart_comcli=1
s_comcli_port=9830
s_secure_port=9831
s_http_port=443
s_netconf_port=6513
s_ftp_port=9921
use_tls=0
use_ftps=0
clientpem=$HOME/Ericsson/OMSec/client.pem
capem=$HOME/Ericsson/OMSec/ca.pem
keypem=$HOME/Ericsson/OMSec/key.pem
#keypass=secret
tls_menu=0
ca_folder=$HOME/Ericsson/OMSec/CAcert
nc_validate=0
smart_shell=1
esci=0
epg_ssr=0
com_username=$USER
#com_password=xxx
#ssh_subsystem=cli

#ssh_kexalg/sftp_kexalg: to specify the value for the openSSH option KexAlgorithms used in ssh/sftp respectively.
#ssh_macs/sftp_macs: to specify the value for the openSSH option MACs used in ssh/sftp respectively.
#ssh_ipqos/sftp_ipqos: to specify the value for the openSSH option IPQoS used in ssh/sftp respectively.
#ssh_keyalg/sftp_keyalg : to specify the value for the openSSH option HostKeyAlgorithms used in ssh/sftp respectively
#Can be used on RCS nodes where the ssh connection is slow or to connect to SFTP export servers using coreFTP instead of openSSH
#ssh_kexalg=ecdh-sha2-nistp256
#sftp_kexalg=diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256
#ssh_macs=hmac-sha1
#ssh_ipqos=lowdelay
#sftp_ipqos=lowdelay
ssh_keyalg=ssh-dss,ssh-rsa 
sftp_keyalg=ssh-dss,ssh-rsa

comcli_netconf_set=0
comcli_netconf_del=0
comcli_netconf_cre=0
comcli_netconf_pcr=0
comcli_netconf_acc=0
netconf_timeout=300
is_netsim=0
esi_nr_bbdumpkeep=2
#comcli_ropdir=/var/filem/nbi_root/PerformanceManagementReportFiles
comcli_ropdate=0
use_keyboard_interactive=0


#===============================================================================
# Export settings. Used on COM nodes for exporting the MOM from Schema MO (comcli_mom=3) and the Logs from Log/LogM MO ("lg" command)
#
#   - export_timeout=60
# The number of seconds until a Log export action will timeout. For the action LogM.exportEsi(), the actual timeout is 20 times the value of export_timeout
#
#   - export_protocol=0
# The protocol for the export: 0 for SFTP (default), or 1 for FTPES . If using FTPES, then the export_port may need to be changed accordingly (usually to 9921).
#
#   - export_wait=0
# The number of seconds to wait between each export. May be needed to set to 1 or 2 when export_protocol=1 in order to not overload the FTPES server
#
#   - export_method=0
# Export to custom SFTP server on a random port specified in the uservariables sshd_port and sshd_range.
# The SFTP server will run on the same machine where moshell is executing and only for the duration of the export.
# No username or password need to be specified. The SFTP port is selected randomly in the range specified by the uservariables sshd_port/sshd_range
# This method only works if the firewall does not block the SFTP ports in that range from the node to the workstation.
# The following uservariables are used by export_method=0: sshd_port, sshd_range, sshd_random
#
#  - export_method=1
# Export to the existing SFTP server running on port "export_port" on the moshell workstation
# With this method, the uservariables export_username and export_password must be set.
# If export_password is not set then it will be prompted at the first export.
# The following uservariables are used by export_method=1: export_username, export_password
# Note: the uv flex_export is automatically set to 1 when exporting logs in AMOS on ENM while logged in as temporary_amos user to allow that user to export to a temporary folder owned by a different unix user on the ENM
#
#  - export_method=2
# Export to a remote SFTP server on port "export_port", the address of the server is specified in the uservariable "export_server"
# Important: the remote SFTP server must be reachable both from the node as well as from the workstation where moshell is running
#            since the logfile will be first transferred from the node to the server, then from the server to the moshell workstation.
# The temporary path where to store the logs on the remote server can be specified with the uv export_dir
# The export_dir setting is optional, but if it has been specified then it must actually exist on the server, moshell will not create it automatically.
# If export_dir has not been specified then the logs will be temporarily stored on the default root path of the SFTP server such as the user's home directory for instance
# After the logs have been successfully transferred back to the moshell workstation, they will be removed from the remote SFTP server.
# With this method, the uservariables export_username and export_password must be set.
# If export_password is not set then it will be prompted at the first export.
# The following uservariables are used by export_method=2: export_username, export_password, export_server
# If export_server points to the same server as where moshell is running then export_method will be automatically changed from value 2 to value 1, unless smart_export=0
# If SFTP to the remote server fails (can happen on some SFTP servers running coreFTP software), it is possible to set the uservariable sftp_kexalg, see example further up in this file.
#
#  - export_method=3
# Export to the node's own SFTP server on port 22, then fetch the files from the node's SFTP server
# This is basically an alias to export_method=2,export_server=<nodeip>,export_username=<nodeusername>,export_password=<nodepassword>
#===============================================================================
export_method=0
sshd_port=10001
sshd_range=999
sshd_random=3
export_timeout=60
export_username=$USER
#export_password=xxx
#export_server=x.y.z.a
export_dir=/tmp
smart_export=1
export_port=22
export_protocol=0
export_wait=0
flex_export=0

#===============================================================================
# LTTNG settings. Used by the "mon" command on MSRBSV2, TCU03, and Evo8300
#  - lttng_port/lttng_range : the range of TCP ports that will be tried for the communication between lttng-relayd and the node.
#  - lttng_flush : the value that will be specified in the "-f" parameter for the "ts ip" command. To not use the "-f" flag, set this uservariable to empty
#  - lttng_buff  : the value of lttng subbuffer in MB (default: 4x1 MB in RCS / 4x4 MB in CPP). This will be specified in "ts ip" options "-n" and "-s". To not use these flags, set this uservariable to empty.
#  - lttng_tracefilesize   : the value that will be specified in the "-z" parameter for the "ts ip" command. To not use the "-z" flag, set this uservariable to empty
#  - lttng_tracefilecount  : the value that will be specified in the "-l" parameter for the "ts ip" command. To not use the "-l" flag, set this uservariable to empty.
#  - lttng_dest  : the server IP address and ports where lttng-relayd is running (in case lttng-relayd shall be run on a different workstation than the current one). Example: 10.20.30.5:5342:5343  or [2001:0db8:85a3::8a2e:0370:7334]:5342:5343
#  - use_babel2  : 0=use the standard babeltrace/babelwrap (default). 1=use babeltrace2/babelwrap2 , a wrapper that redirects messages from stderr to stdout
#  - lttng_localhost : whether the babeltrace client shall connect to localhost or toward the IP address of the server where lttng-relayd is running. Default is 0, meaning the IP address will be used. If a firewall is blocking TCP connections to its own IP then lttng_localhost can be set to 1 so it will connect to localhost instead.
#===============================================================================
lttng_port=5342
lttng_range=999
#lttng_dir=/tmp
lttng_flush_rcs=2000000
lttng_flush_cpp=4000000
lttng_buff_rcs=4x1
lttng_buff_cpp=4x4
lttng_tracefilesize_cpp=4194304
lttng_tracefilesize_rcs=1048576
lttng_tracefilecount_cpp=2
lttng_tracefilecount_rcs=2
use_babel2=0
lttng_localhost=0
#lttng_dest=<ipaddress>:<controlport>:<dataport>

#===============================================================================
# LTTNG keepalive settings. Used by the "mon" command on MSRBSV2, TCU03, and Evo8300
# - lttng_keepalive: 0=disabled. 1=enabled (default) => enable dead-peer detection to avoid hanging open file descriptors due to loss of connection between lttng-relayd and the node
# - lttng_keepalive_time: the interval between the last data packet sent and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further
# - lttng_keepalive_probes: the number of unacknowledged probes to send before considering the connection dead and notifying the application layer
# - lttng_keepalive_intvl: the interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
#  LTTNG_NETWORK_SOCKET_TIMEOUT
# - lttng_nwsocket_timeout: socket connection receive and send timeout in milliseconds. Default: 0 (uses operating system default)
#===============================================================================
lttng_keepalive=1
lttng_keepalive_time=5
lttng_keepalive_probes=10
lttng_keepalive_intvl=1
lttng_nwsocket_timeout=0

#===============================================================================
# LTTNG relayd options
#  - lttng_relayd_options: to pass any set of options to the lttng-relayd process, eg debug options
#  - lttng_groupbysession (0=by host, 1=by session): if set to 1, the lttng-relayd CTF folder structure will be organised by session instead of by host, eg: $LTTNG_HOME/lttng-traces/'SESSION'/'HOST'/'DOMAIN'
#  - lttng_fdpoolsize : the maximum number of file descriptors that may be kept open simultaneously by the lttng-relayd process (if 0 then this option is not set and the soft RLIMIT_NOFILE resource is used)
#  - lttng_workingdir : the working directory of the processes started by lttng-relayd. Controls where core dumps will be stored
#===============================================================================
#lttng_relayd_options=-vvv,>,$logdir/$ipaddress_lttngdebug.log,2>&1
lttng_fdpoolsize_cpp=1000
lttng_fdpoolsize_rcs=0
lttng_workingdir_cpp=/tmp
lttng_workingdir_rcs=/tmp
lttng_groupbysession_cpp=1
lttng_groupbysession_rcs=0

#===============================================================================
# MONU settings. Used by the "monu" command
#  - udp_router  : applicable for CPP nodes.  To specify the ip address of the server where UDP trace router is running. If empty, the address of moshell workstation will be used.
#  - bbte_router : applicable for Gen2 nodes. To specify the ip address of the server where UDP trace router is running. If empty, the address of moshell workstation will be used.
#  - bbte_buffer_rate : if this value is more than 0, then the following parameters will be given to bbte setdest: --buffer emca -bitrate <buffer_rate>
#  - bbte_mode   : applicable for Gen2 nodes. To specify the value of the parameter "-mode" in the command "bbte log setdest". If unspecified then the default value "normal" is used. To see the list of supported values type "bbte log setdest"
#  - bbte_dscp   : applicable for Gen2 nodes. To specify the value of the parameter "<dscp>" in the command "bbte log setdest". If unspecified, then the default value will be used.
#  - bbte_capture_duration: optional parameter for $capcommand (-d, --duration <time>)
#  - bbte_capture_size: optional parameter for $capcommand (-s, --size <size>)
#  - bbte_capture_rotate: optional parameter for $capcommand (-R, --rotate <count>)
#  - bbte_dir    : an alternative folder where $capcommand shall store the .pcap and .stats files
#===============================================================================
#udp_router=
#bbte_router=
bbte_buffer_rate=200000
bbte_port=33079
#bbte_mode=normal
#bbte_dscp=50
#bbte_capture_duration=10s
#bbte_capture_size=200M
#bbte_capture_rotate=2

#==============================================================================
#  Dia GW security certificates
#  - diagw_port/diagw_range : the range of TCP ports that will be tried for the communication towards diagateway.
#  - diagw_cert/diagw_key  : TLS certificate and privatekey to authenticate user credentials in diagateway
#  - diagw_binpath : Dia Gateway binary path
#  - diagw_connection_service_port : the port that will receive incoming connection for dia.
#  - diagw_connection_service_num_ports :  the range of ports that will be tried if the diagw_connection_service_port is busy.
#  - diagw_host : variable to be used in future if moshell has to support running diagw on any other host rather then localhost.
#  - diagw_ca/diagw_rootca/diagw_key/diagw_cert : path to TLS credential files. Set automatically on Cloud RAN when using use_tls=31.
#  - diagw_sa_ipv4/diagw_sa_ipv6 : the ipv4 and ipv6 address of the workstation's interface toward the node, can be seen in variable $ws_ip
#==============================================================================
diagw_sa_ipv6=
diagw_sa_ipv4=
diagw_connection_service_port=11881
diagw_connection_service_num_ports=25
diagw_ca=
diagw_rootca=
diagw_port=9002
diagw_range=999
#diagw_host="localhost"
diagw_cert=
diagw_key=
diagw_fqdn=
#diagw_folder=""
diagw_binpath=$moshelldir/commonjars/dia-gateway

#==============================================================================
# Handling of COLI in RCS nodes (RBS Gen2 / TCU03)
# coli_shell=0  => COLI commands cannot be run transparently, only by going specifically into RCS-COLI mode, by typing the command "coli"
# coli_shell=1  => RCS-COLI commands can be run transparently and seamlessly
# coli_shell=2  => RCS-COLI is not used, instead the COLI commands will run on linux shell via ssh to port 22 and the login will be done with linux_username and linux_password
#==============================================================================
coli_shell=1
linux_username=root
linux_password=root

#==============================================================================
# Fast read of Ericsson-Only attributes in MSRBSv2
# Requires the feature license "Hidden Parameter Access" (CXC4012188/FAJ1214785) to be installed and activated on the node.
# use_testmomdump=0 => the command "internalmomread" will be used
# use_testmomdump=1 => the command "testmomdump" will be used (faster)
#==============================================================================
use_testmomdump=1

#==============================================================================
# Fast read of SFP values. Only applicable for MSRBS >= 20.Q2
# Uses coli command "sfpdump" on Baseband board instead of coli command "sfp" on RU/XMU
# use_sfpdump=0 => the command "sfp" on each RU/XMU will be used
# use_sfpdump=1 => the command "sfpdump" on BB will be used (faster)
#==============================================================================
use_sfpdump=1

#===============================================================================
# Support for Linux-based nodes (SIU, TCU, COM, CPP-linux)
# lincli=0 (default, OSE based CPP node)
# lincli=1 (linux based nodes)
# lincli=2 (OSE based SIU nodes)
# lincli=3 (AXE nodes)
#===============================================================================
lincli=0

#===============================================================================
# Settings for inv/sdi:
#  - fast_inv_threshold: Fast inv. Only applicable for DUS Gen2. The number of XP boards above which part of the inv command will be run in a parallel process. Default: 6
#  - inv_have_sts: The sts printout is included in inv/sdi printout (0=no, 1=yes)
#  - inv_have_pget: The pget printout is used when connected to real node (0=no, 1=yes). If no then counters read only from ropfiles.
#  - inv_cut_cellnames: If the cell names start with the node name then the node name part of the cell name is cut in order to save space (0=no, 1=yes)
#===============================================================================
fast_inv_threshold=6
inv_have_sts=1
inv_have_pget=1
inv_cut_cellnames=1

#===============================================================================
# Settings for dcg:
#  - dcg_name_utc=0/1   : the timestamp in dcg file name. 0= local timezone of the moshell workstation . 1=utc timezone
#  - dcg_no_telog=0/1/2 : specify whether T&E logs shall be included in the MSRBS dcg. Default: 0=included. If set to 1=excluded , then the T&E logs will still be available in the ESI. If set to 2=only C2 excluded , then only the T&E logs of C2 boards will be excluded 
#  - dcg_no_coli=0/1    : specify whether RRU/XMU/PIMCU "dcg run" COLI shall be included in the MSRBS dcg. Default: 0=included. If set to 1=excluded , then the COLI printouts will still be available in the ESI
#  - dcg_no_bg=0/1    : specify whether dcg should use background processes. Default: 0=Background processes allowed (=>faster but uses more processes/memory). 1=Maximum of one background process allowed at a time (=> dcg will take longer but use fewer resources on the client)
#===============================================================================
dcg_name_utc=0
dcg_no_telog=0
dcg_no_coli=0
dcg_no_bg=0

#===============================================================================
# Show DU path. Only applicable for DUS Gen2
# On MSRBS SW >= 18.Q3 , the hunt path is changed from DU path (BXP_x_y_z) to UnitId (BXP_xxxx)
# When turning on this uv, the DU path will be shown as a distinct column in the inv HW table. Default: 0 (disabled, as this is mainly intended for trouble-shooting)
#===============================================================================
show_du_path=0

#===============================================================================
# Enable/disable moshell debug printouts (1=enabled, 0=disabled)
# Can also take the value 99, only to be used when run from an expect script. See TR WRNae06245
# Can also take the value 999, which gives the same behaviour as 99 plus that the answer to prompts from cr/acc/etc are echoed
# When mosdebug is set to 99/999 , the uservariable mjedebug can be used instead, to get debug printouts
#===============================================================================
mosdebug=0
mjedebug=0

#===============================================================================
# Enable/disable jacorb debug printouts (1=enabled, 0=disabled)
# Can also take the value 2 for SSL printouts, only to be used in case corba security issues
#===============================================================================
corba_debug=0

#===============================================================================
# Enable/disable openssl debug printouts
# tls_debug=0 -> no debug flags
# tls_debug=1 -> -msg -state -showcerts
# tls_debug=2 -> -msg -state -showcerts -debug
#===============================================================================
tls_debug=0

#===============================================================================
# Version of the polyhedra sql database reader, used in sql mode and dbc command
#  - 0: version 6.0, supported on solaris and linux, allows read and write to the db.dat, might not work on the newest CPP releases (CPP9 and above)
#  - 1: latest version (9.0), supported on solaris, linux, and cygwin, read-only (cannot write to db.dat). Supports all CPP releases.
#  - 83, 84, 86, 87, 88, 89, 90 : to explicitely specify a version (8.3, 8.4, 8.6, 8.7, 8.8, 8.9, 9.0)
#===============================================================================
polyversion=1

#==============================================================================
# Sql port: the starting point for the range of ports used in sql mode and dbc command
# The SQL client uses this port to communicate with the SQL server on the workstation.
# This communication is only internal on the workstation, not with the node.
# The default range of ports consists of twice 500 ports, where the starting point is the port given in "sql_port", e.g. 8001-8500 for CPP OSE and 8500-9000 for CPP Linux
# The scanning of ports can be :
#   * non-random (sql_random=0)
#   * random (sql_random=1 -> shuffle up to 10 times)
#   * extra random (sql_random=2 -> shuffle up to 100 times)
#   * extra-extra random (sql_random=3 -> shuffle up to 1000 times)
# The sql_random is needed when running dbc from mobatch in order to ensure that there will not be any collision of sql ports between sessions running at the same time
#==============================================================================
sql_port=8001
sql_range=499
sql_random=0

#===============================================================================
# Allow/Forbid corba connection (0=allow, 1=forbid)
# Value 1 means that moshell will not attempt to connect to the node via corba, only telnet/ftp/ssh/sftp
# Can also be activated by starting moshell/mobatch with option "-l" (light mode)
#===============================================================================
nocorba=0

#===============================================================================
# Allow/Forbid MO loading in SQL mode (0=allow, 1=forbid)
# Value 1 means that moshell will not read the MO data tables when loading a db.dat with option "-d"
# The startup time will be much faster but only SQL commands will then be available, not MO commands
#===============================================================================
nomo=0

#===============================================================================
# Handling of deprecated attributes and counters
#  0=Keep the deprecated attributes, actions, and counters
#  1=Exclude the deprecated attributes and notInMOM counters at create MO (cr command) and create scanner (pcr command)
#  2=Deprecated attributes and counters are completely taken out of the MOM and not visible in any MO command (cr/pcr/get/pget/mom/pmom/etc)
#  3=Same as option 2 , and exclude the deprecated MO actions
#  4=Same as option 3 , and exclude the deprecated struct members from undo commandfile
#===============================================================================
exclude_deprecated=4

#===============================================================================
# Handling of preliminary attributes and counters
#  0=Keep the preliminary attributes and counters
#  1=Preliminary attributes and counters are completely taken out of the MOM and not visible in any MO command (cr/pcr/get/pget/mom/pmom/etc)
#===============================================================================
exclude_preliminary=1

#===============================================================================
# Set timeout in SSU for communication with SLS server (in seconds)
# If no valid SLS server can be found before this timeout expires, secure connection to node will fail.
# Value should be set to 10 * (number of SLS servers) to make sure all available server are attempted before connection fails.
#===============================================================================
sls_timeout=30

#===============================================================================
# The maximum time the corba polling will go on for. After this time, the corba connection is disconnected and reconnected.
# Default 20 minutes (1200 seconds). Use 0 for infinite value.
# Note: on RBS/ERBS/RXI, the max_poll_time is 5 minutes.
#===============================================================================
max_poll_time=1200

#===============================================================================
# Command restriction
#  * 0: no restriction
#  * 1: block commands specified in the file(s) listed in the uservariable "blocked_commands"
# It is possible to specify several files in this uv, eg: blocked_commands=/path/to/file1,/path/to/file2
# These files shall contain one blocked command per line
# The blocked commands can be moshell commands or coli commands
# It is possible to use regular expression characters in the command name, but if it is a moshell command, then the command name must be preceded by a tilde sign (~).
# If no regular expression characters are used in the command name then moshell will be able to distinguish automatically if the command is a moshell command or coli command.
# See example files in the folder moshell/examples/command_restriction
#===============================================================================
command_restriction=0
#blocked_commands=$moshelldir/examples/command_restriction/coli_commands.txt,$moshelldir/examples/command_restriction/write_commands.txt,$moshelldir/examples/command_restriction/other_commands.txt

#===============================================================================
# Search listme: to search for the node's ip address in the OSSRC utility "listme" when not found in ipdatabase.
# Only applicable when running moshell on a OSSRC.
#  * 0: dont search listme
#  * 1: search listme
#===============================================================================
search_listme=1

#===============================================================================
# Disable multimode
#  * 0: multimode allowed (default)
#  * 1: multimode not allowed
#===============================================================================
nomulti=0

#===============================================================================
# gpg retry: the number of times that the gpg command will retry to decrypt the logfile in case of loss of connection with CSDP server
#===============================================================================
gpg_retry=3

#===============================================================================
# Name of the sysconwrite command, used in "scw"
#===============================================================================
sysconwrite=sysconwrite

#===============================================================================
# Filtering of HcRule MOs. Only takes effect in interactive mode (not when running a .mos script)
# 0: no filtering
# 1: Doing a MO command with a MO-filter matching any of the strings listed in "hcrule_filter_list" will omit the HcRule MOs
# 2: (default) HcRule MOs will be skipped unless the MO-filter matches the word "hcru" or matches the MO id of the HcRule MO and not a MO class
#===============================================================================
use_hcrule_filter=2
hcrule_filter_list=cell,nbap

#===============================================================================
# Mobatch configuration settings
# - max_p_option: the maximum allowed value for the "-p" option (0=unlimited)
# - max_nodes: the maximum number of nodes allowed to specify in the sitefile (0=unlimited)
# - max_processes: the number of parallel moshell sessions that will be run when "-p" option has not been specified (default: 10)
# - i_option: the offset value when the "-i" option has not been specified (default: 0)
#===============================================================================
mobatch_max_p_option=0
mobatch_max_nodes=0
mobatch_max_processes=10
mobatch_i_option=0


#######################################################

#===============================================================================
# Enable/disable printing of "logstart"/"logclose" information in l+/l- (1=enabled, 0=disabled)
#===============================================================================
loginfo_print=1

#==============================================================================
# The list of attributes that are not displayed on screen by the CS notification client (runClient.sh -c)
#==============================================================================
csnotiflist=availabilitystatus

#==============================================================================
# Activate/deactivate workaround for handling of blank space in the MO id.
# All blank spaces in MO identities are displayed as the @ sign
# When creating MOs with the "cr" command, the @ sign is replaced by a blank space
# 1=enabled, 0=disabled. By default this feature is turned on (recommended).
#==============================================================================
mospace_convert=1

#==============================================================================
# Default xml-MOM file (in case not stored on node, e.g. prior to the first SW upgrade)
# MGW R2 MOM can be downloaded from http://internal.ericsson.com/page/hub_corenetwork/unit/pdu_ipconnectivity_control/node_mgw/mgw_supply_and_support/plm.html
# Click on "release binders". The latest MOM is included in the latest release binder.
# MGW R3 MOM can be downloaded from http://mgw.lmf.ericsson.se/projects/r3/system/MGwR3_MOM/
# MGW R4 MOM can be downloaded from http://mgw.lmf.ericsson.se/projects/r4/sm/MOM/index_4.1.html
# MGW R5 MOM can be downloaded from http://vobs.lmf.ericsson.se/wcs/mmgw/r5/mgwr5_oam_appl_mom/xml_storage/
# MGW R6/R6.1 MOM can be downloaded from https://webse1.rnd.ki.sw.ericsson.se/vobs/mmgw/sw/oam_appl_mom/build/xml_storage/
# NOTE: this setting is superceeded by the setting in ~/.moshellrc file.
# Please set this variable in ~/.moshellrc instead .
# Alternatively, transfer the MOM to the node, into the directory /c/public_html/cello/oe/xml and rename it to CelloMOM.xml
# This way, the correct MOM will be used for each node, rather than the default MOM.
#==============================================================================
default_mom="$moshelldir/commonjars/CPP_MOM-CPP-LSV144-gen1_gen1.xml.gz"

#==============================================================================
# Enable polling for o-ran notifications. This variable does not control
# mandatory notifications, such as download-event.
# * 1: Polling enabled
# * 0: Polling disabled
#==============================================================================
oran_poll=1

#==============================================================================
# Finding out the OS
#==============================================================================
unamea=$(uname -a)

#==============================================================================
# AMOS parameters used for licensing of the amos/moshell feature.
#
# amos_debug can have following values :
#   - 0 (or false) - no debug
#   - 1 (or true)  - some debug printouts
#   - 2            - more debug printouts
#
# AMOS log interval (amos_log_interval) :
# to specify the interval (in minutes) after which the AMOS command history will be written to LogViewer/SMLog.
# Default=0 (=> command history will be written at the end of the AMOS session)
#
# AMOS Account Lookup (amos_enm_accountlookup) :
# Note: only applicable for ENM, not OSSRC
#   - 0: the AMOS Account Lookup feature will not be used. Can be useful to disable this feature in case the account lookup is causing long delays
#   - 1 (default): AMOS will query ENM to create a temporary ldap account to login to the node as well as for log export to the AMOS server (export_method=1)
#   - 2: same as 1 but will also try to use the temporary ldap account for log export to external server (export_method=2)
#==============================================================================
if [[ $moshelldir = /opt/ericsson/amos/moshell* ]] ; then
amos_debug="false"
amos_process_logging="true"
amos_java="$JAVA_HOME/bin/java"
amos_log_interval=0
amos_enm_accountlookup=1
if [[ $unamea = SunOS* ]] ; then
source /etc/opt/ericsson/system.env
fi
export NSA_CLASSPATH PAS_CLASSPATH PORTAL_CLASSPATH SECURITY_CLASSPATH SENTINEL_CLASSPATH TSS_CLASSPATH BORLAND_HOME JAVA_HOME JAVAFLAGS NameServiceHost NameServicePortGB HOSTNAME
fi


#######################################################
#  OTHER SETTINGS (!! DO NOT EDIT !!)
#######################################################
use_sfpvalues=0
emcli=0
vobsinstallation=0  #Will be automatically set to 1 when installing moshell with "bash moshell_install -vk": this is done when the same moshell shall be run both from solaris and linux. Installation must be done from the solaris/sparc machine
unr=0
mosro=0
thisdate=$(date +%Y%m%d)
thistime=$(date +%H%M%S)
serialNumber="${thisdate}-${thistime}_$$"
gawkext=""
gawklib=""
binext=""
gawkopt=""
if [[ $unamea = [Ll][iI][nN][uU][xX]*x86_64* ]] ; then gawklib="lin64"   ; binext=".lin64" ; if [[ $vobsinstallation = 1 ]] ; then gawkext=".lin64"                     ; fi
elif [[ $unamea = [Ll][iI][nN][uU][xX]* ]]      ; then gawklib="linux"                     ; if [[ $vobsinstallation = 1 ]] ; then gawkext=".linux"   ; binext=".linux" ; fi
elif [[ $unamea = SunOS*sparc* ]]               ; then gawklib="solaris"                   ; if [[ $vobsinstallation = 1 ]] ; then gawkext=".solaris"                   ; fi
elif [[ $unamea = SunOS* ]]                     ; then gawklib="sol86"                     ; if [[ $vobsinstallation = 1 ]] ; then gawkext=".sol86"                     ; fi
else gawklib="cygwin" ; gawkext=".exe" ; binext=".exe"
fi
gawkprog="gawk${gawkext}"
gawk="LANG=C LC_ALL=C $moshelldir/$gawkprog"

#special case where moshell has been installed on a linux 32 bit machine but should be run on linux 64 sharing the same file system
if [[ $unamea = [Ll][iI][nN][uU][xX]*x86_64* && $vobsinstallation != 1 && `file "$moshelldir/gawk"` = *32-bit* ]] ; then gawklib="linux" ; fi

filefunc="$moshelldir/commonjars/lib/${gawklib}/filefuncs"
#LD_LIBRARY_PATH should not start or end with a colon sign. The expression below indicates to only put "$LD_LIBRARY_PATH:" if it is set and non-null
export LD_LIBRARY_PATH=$moshelldir/commonjars/lib/${gawklib}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
programfile="$moshelldir/prog.awk"
iorfiledir="$moshelldir/iorfiles"
funcs="$moshelldir/funcs.awk"
defLogDir=$commonjardir/defLogDir.sh
moshellrc=$($defLogDir)
globmoshellrc=$jarxmldir/moshellrc
if [[ ! -r $globmoshellrc ]] ; then cp $globmoshellrc.template $globmoshellrc ; fi
#read the value of set_window_title from jarxml/moshellrc and ~/.moshellrc since it is used in the trap cleanup function
tmp_window_title=`$moshelldir/$gawkprog '$1~/^set_window_title/{print gensub(/^.*= *| *#.*$/,"","g",$0)}' $globmoshellrc`
if [[ $tmp_window_title = 0 || $tmp_window_title = 1 ]] ; then set_window_title=$tmp_window_title ; fi
tmp_window_title=`$moshelldir/$gawkprog '$1~/^set_window_title/{print gensub(/^.*= *| *#.*$/,"","g",$0)}' $moshellrc`
if [[ $tmp_window_title = 0 || $tmp_window_title = 1 ]] ; then set_window_title=$tmp_window_title ; fi

#Finding out the logdirectory
temp_logdir="unknown"
logdir="$moshelldir/logfiles/logs_moshell"
while getopts "lv:uc:nmdo:a:eft:gx:y:w:jz" options
do
case $options in
o) temp_logdir="$OPTARG"
   if [[ -f $temp_logdir ]] ; then temp_logdir="unknown"
   else mkdir -p $temp_logdir ; fi
   if [[ $temp_logdir != /* ]] ; then temp_logdir=`pwd`/$temp_logdir ; fi
   if [[ -w $temp_logdir && -d $temp_logdir ]] ; then : ; else temp_logdir="unknown" ; fi
   ;;
esac
done
unset OPTIND
umask=$(umask)
if [[ $temp_logdir = "unknown" ]] ; then
temp_logdir=$($defLogDir moshell)
umask 000
fi
if [[ -w $temp_logdir && -d $temp_logdir ]] ; then logdir=$temp_logdir ; fi
if [[ $moshelldir = /opt/ericsson/amos/moshell* ]] ; then logdir=$temp_logdir ; fi
if [[ -w $logdir && -d $logdir ]] ; then :
else
   echo "ERROR: Unable to write to log directory $logdir. Exiting..." 
   exit 1
fi
if mkdir -p $logdir/tempfiles ; then tempdir=$logdir/tempfiles ; else tempdir=/tmp ; fi
if [[ $moshelldir = /opt/ericsson/amos/moshell* && $unamea = [Ll][iI][nN][uU][xX]* ]] ; then 
freetmpspace=`df -k /var/tmp| /opt/ericsson/amos/moshell/gawk 'NF>4&&$(NF-2)~/^[0-9]+$/{print $(NF-2)}'`
if [[ $freetmpspace -gt 5000000 ]] ; then tempdir=/var/tmp ; fi
fi
tempdir=$tempdir/$serialNumber
mkdir -p $tempdir
if [[ -d $logdir/undo && -d $logdir/moscomlogs && -d $logdir/fclean && -d $logdir/diff && -d $logdir/lg && -d $logdir/hc/logs && -d $logdir/hc/reports && -d $logdir/resub && -d $logdir/remod && -d $logdir/rset && -d $logdir/sessionlog && -d $logdir/logs_monode && -d $logdir/other && -d $logdir/gnuplot && -d $logdir/cache && -d $logdir/dcg && -d $logdir/bg && -d $logdir/pmdfiles && -d $logdir/pmfiles && -d $logdir/cv && -d $logdir/lttng-traces && -d $logdir/tsRamdisk && -d $logdir/oru ]] ; then :
else
mkdir -p $logdir/undo
mkdir -p $logdir/resub
mkdir -p $logdir/hc/logs
mkdir -p $logdir/hc/reports
mkdir -p $logdir/lg
mkdir -p $logdir/remod
mkdir -p $logdir/rset
mkdir -p $logdir/sessionlog
mkdir -p $logdir/logs_monode
mkdir -p $logdir/moscomlogs
mkdir -p $logdir/other
mkdir -p $logdir/diff
mkdir -p $logdir/fclean
mkdir -p $logdir/gnuplot
mkdir -p $logdir/cache
mkdir -p $logdir/dcg
mkdir -p $logdir/bg
mkdir -p $logdir/pmdfiles
mkdir -p $logdir/pmfiles
mkdir -p $logdir/cv
mkdir -p $logdir/lttng-traces
mkdir -p $logdir/tsRamdisk
mkdir -p $logdir/oru
fi
umask $umask
if [[ $moshelldir = /opt/ericsson/amos/moshell ]] ; then
   chmod 1777 $logdir/tempfiles $tempdir $logdir/undo $logdir/resub $logdir/hc $logdir/lg $logdir/remod $logdir/rset $logdir/sessionlog $logdir/logs_monode $logdir/moscomlogs $logdir/other $logdir/diff $logdir/fclean $logdir/hc/logs $logdir/hc/reports $logdir/gnuplot $logdir/cache $logdir/dcg $logdir/bg $logdir/pmdfiles $logdir/pmfiles $logdir/cv $logdir/lttng-traces $logdir/tsRamdisk $logdir/oru
   #TORF-372773
   if [[ $unamea = [Ll][iI][nN][uU][xX]* ]] ; then
       chmod 1700 $tempdir $logdir/tempfiles $logdir/undo $logdir/resub $logdir/hc $logdir/lg $logdir/remod $logdir/rset $logdir/sessionlog $logdir/logs_monode $logdir/other $logdir/diff $logdir/fclean $logdir/hc/logs $logdir/hc/reports $logdir/gnuplot $logdir/cache $logdir/dcg $logdir/bg $logdir/pmdfiles $logdir/pmfiles $logdir/cv $logdir/lttng-traces $logdir/tsRamdisk $logdir/oru
       chmod 1755 $logdir/moscomlogs
   fi
   echo "BEGIN{}" > "$tempdir/amosvarfile"
fi
#the lgcsv folder is not applicable anymore so we move it to "old" (disabled for the moment, causes error messages in some cases)
#if [[ -d $logdir/lgcsv ]] ; then mv $logdir/lgcsv $logdir/old_lgcsv ; fi

tempior="$tempdir/ior$$"
argumentfile="$tempdir/argumentfile$$"
tempother="$tempdir/other$$"
unzip="unzip"
bash="/bin/bash"
if [[ $unamea = SunOS*sparc* ]] ; then
    if [[ $vobsinstallation = 1 ]] ; then unzip=$commonjardir/unzip.solaris ; bash=$commonjardir/bash.solaris
    else unzip=$commonjardir/unzip ; bash=$commonjardir/bash
    fi
    export PATH=${PATH}:/usr/ucb   #workaround for whoami sometimes not found on solaris/sparc
elif [[ $unamea = SunOS* ]] ; then
    #needed for lttng trace streaming on EvoC8300
    ulimit -n 32000  2>/dev/null
    if [[ $vobsinstallation = 1 ]] ; then bash=$commonjardir/bash.sol86 ; else bash=$commonjardir/bash ; fi
elif [[ $unamea = *Android ]] ; then
	bash="/usr/bin/env -S bash"
elif [[ $unamea = Linux*x86_64* ]] ; then
    if [[ $vobsinstallation = 1 ]] ; then bash=$commonjardir/bash.lin64 ; else bash=$commonjardir/bash.lin64 ; fi
elif [[ $unamea = Linux* ]] ; then
    if [[ $vobsinstallation = 1 ]] ; then bash=$commonjardir/bash.linux ; else bash=$commonjardir/bash ; fi
elif [[ $unamea = CYGWIN* ]] ; then
    export CYGWIN=nodosfilewarning
fi
if [[ $unamea = SunOS* ]] ; then
    if [[ -z "$TZ" ]] ; then TZ=`$moshelldir/$gawkprog '$1~/^TZ=.+/{print gensub(/^TZ=|"/,"","g",$1)}' /etc/TIMEZONE` ; fi
elif [[ $unamea = Linux* ]] ; then
    if [[ -z "$TZ" ]] ; then
        if [[ -f /etc/sysconfig/clock ]] ; then TZ=`$moshelldir/$gawkprog '$1~/^TIMEZONE=.+/{print gensub(/^TIMEZONE=|"/,"","g",$1)}' /etc/sysconfig/clock`
        elif [[ -f /etc/timezone ]] ; then TZ=`$moshelldir/$gawkprog '$1!=""{print $1}' /etc/timezone`
        else
        	$moshelldir/$gawkprog -v tzfile="$tempdir/tz$$" -f $moshelldir/commonjars/find_tz.awk
        	TZ=`cat $tempdir/tz$$`
        fi
    fi
fi
if [[ "$TZ" ]] ; then export TZ ; fi
##########################################################################
#  END OF DEFINITIONS
##########################################################################

##########################################################################
#     FUNCTIONS
##########################################################################


function get_ip_address(){
LANG=C LC_ALL=C $moshelldir/$gawkprog -v iorfile=$iorfile 'BEGIN{
	FS=""
	getline < iorfile
	close(iorfile)
	iorline=tolower($0)
	match(iorline,/(3[0-9])+2e(3[0-9])+2e(3[0-9])+2e(3[0-9])+00/)
	$0=substr(iorline,RSTART,RLENGTH-2)
	temp=""
	for (i=2;i<=NF;i=i+2) temp=temp $i
	ip_address = gensub("e",".","g",temp)
	if (ip_address !~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)
	{
		#ipv6
		l[1]="a";l[2]="b";l[3]="c";l[4]="d";l[5]="e";l[6]="f"
		#match(iorline,/(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+00/)
		match(iorline,/(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])+3a(3[0-9]|[46][1-6])*3a(3a|3[0-9]|[46][1-6])+00/)
		$0=substr(iorline,RSTART,RLENGTH-2)
		temp=""
		#print "debug: "$0 > "/dev/stderr"
		for (i=1;i<NF;i+=2)
		{
			if ($i==3)
			{
				#temp=temp $(i+1)
				if( $(i+1) == "a" ) temp=temp":"
				else temp=temp $(i+1)
			}
			else if ($i==4 || $i==6) temp=temp l[$(i+1)]
		}
		#ip_address=gensub("a",":","g",temp)
		ip_address=temp
	}
	#print "debug: "ip_address >"/dev/stderr"
	print ip_address
	}'
}

function cleanup()
{
if [[ $moshelldir = /opt/ericsson/amos/moshell ]] ; then
        LANG=C LC_ALL=C $moshelldir/$gawkprog -v moshell_pid=$$  -v moshelldir="$moshelldir" -v amos_process_logging=true -v amos_ps_logfile=/var/opt/ericsson/amos/sessions_`hostname`.log -f "$funcs" --source 'BEGIN{amos_process_log(moshell_pid,"1")}'
        if test -s "$tempdir/amosvarfile" ; then
		LANG=C LC_ALL=C $moshelldir/$gawkprog -f "$tempdir/amosvarfile" -f "$funcs" -l "$filefunc" --source 'BEGIN{parse_common_variables();log_amos()}'
        fi
fi
if test -s "$tempdir/lgnlastcmd" && test -s "$tempdir/lgnvarfile" ; then
	#echo "LGN:" ; cat "$tempdir/lgnlastcmd"
	LANG=C LC_ALL=C $moshelldir/$gawkprog -f "$tempdir/lgnvarfile"  --source 'BEGIN{ if (system("test -s "moscomlog)!=0 && system("test -s "moscomlog".gz")==0) system("gzip -d "moscomlog".gz") ;while (getline < templastmoshellcmd) { print $0 >> moscomlog } ; close(moscomlog) }'
fi
sshdpid=`cat $tempdir/sshdpid.log 2>/dev/null`
#echo "sshdpid=${sshdpid}x"
if [[ "$sshdpid" = [0-9]* ]] ; then
	#echo "kill $sshdpid"
	kill $sshdpid
	#kill -9 $sshdpid
fi
rm -rf $tempdir/*
rmdir $tempdir 2>/dev/null
if test $set_window_title -eq 1  ; then echo -e "\x1B]0; \a" ; fi
exit
}

function moshell_noargs()
{
cat <<EOF
Usage:
 1) Online mode : moshell [-v uservariables] [-efg] [-a <rcfiles>] [-n]  [-t <ip>[:port]] <site-name>|<ip-address>|<host-name>|<ior-file> [<command(s)>|<commandfile>] [<logfile>]
 2) Offline mode: moshell [-v uservariables] [-efg] [-a <rcfiles>] [-j]  [<MO-dump>|<dcglogs-zipfile>]  [<command(s)>|<commandfile>] [<logfile>]
 3) Multi mode  : moshell [-v uservariables] [-efg] [-a <rcfiles>] -m    <sitelist>|<sitefile> [<command(s)>|<commandfile>] [<logfile>]
 4) SQL mode    : moshell [-v uservariables] [-efg] [-a <rcfiles>] -d [-v nomo=1] <db.dat>|<cv.zip>|<dbdump.zip>
 5) YANG mode   : moshell [-v uservariables] [-efg] [-a <rcfiles>] -z    <sitelist>|<sitefile> [<command(s)>|<commandfile>] [<logfile>]

Online means that moshell is connected to a node.
Offline is used for browsing logs with moshell, e.g. an MO-dump, a set of ROP files, or a set of CPP logfiles.
Multimode means that moshell is connected to several nodes at the same time. Use -m option for CPP nodes or -z option for Yang nodes.
SQL mode means that moshell is connected to a db.dat, cv.zip (fetched with cvget), or dbdump.zip (fetched with cvgetd).
YANG mode means that moshell is connected to one or more nodes over NETCONF/YANG. Currently supported for RCS and ADP (Cloud) nodes.
Refer to the chapter "Modes of operation" in the User Guide for more information.

The "-v" option is for setting uservariables from the command line. See README file chapter 0.2 for more info.
The "-v" option can also be used for setting scripting variables from the command line. In this case, the "$" sign in front of the variable name should be omitted. See README chapter
The "-n" option is for disabling the check of IP contact at startup.
The "-e" option is to skip sourcing of the global moshellrc file (moshell/jarxml/moshellrc)
The "-f" option is to skip sourcing of the user's moshellrc file (~/.moshellrc)
The "-g" option is for gzipping the logfile after completion (only applicable when a logfile has been specified)
The "-a" option is to source some additional moshellrc files, eg: -a file1,file2. These files will be sourced after the global moshellrc and before the user's .moshellrc.
The "-t" option is to use a time server when connecting to an emulated node. If the optional port argument is not specified, the default port of 8123 will be used.
The "-j" option can be used for faster startup in offline mode connected to a dcgm. It then skips loading of large COLI files.

The argument can be:
 * <site-name> : refers to the node's name as defined in the ipdatabase file (whose path is defined in moshell file).
 * <host-name> : refers to the node's name as defined in DNS.
 * <ip-address>: raw ip address
 * <ior-file>  : an iorfile that has been stored on the workstation.
 * <sitelist>  : the list of sites to connect to, eg: site1,site2,site3. Applicable with option "-m" only.
 * <sitefile>  : the file containing the list of sites, one site per line. Applicable with option "-m" only.
 * <MO-dump>   : the MO dump is a file obtained with the command "dcgk" or "lt all;kget". It can be in text format, .gz format, or .zip format.
 * <dcglogs-zipfile> : a zipfile containing all the logs produced by the dcgm command (modump.zip, logfiles.zip, ropfiles.zip)

Logfiles and temporary files are automatically stored under ~/moshell_logfiles/logs_moshell. This path can be changed either by setting the uservariable "logdir" in the file ~/.moshellrc or from command line with the option "-o <logdirectory>".

Examples, online mode:
 * moshell 10.121.7.33
 * moshell -v security_method=2,sa_credential=~/sam.pbe,sa_password=oemas 10.1.128.17
 * moshell -v telnet_port=2323,http_port=8080 rnc3
 * moshell rbs28 ~/tools/moshell/cmdfiles/runSwTest.cmd
 * moshell bsc5 'vii ; cabslxrd ; lh mp te log read | grep ERROR ; lt plug ; st all dis ; get all all '
 * moshell 10.121.2.37 'vii ; lh mp te log read | grep ERROR ' ~/moshell_logfiles/nodeTest.log
Examples, offline mode:
 * moshell ~/moshell_logfiles/logs_moshell/sessionlog/RNC37_modump.zip  #interactive mode
 * moshell ~/modumps/mgw1_kget.log.gz 'pr ; get ; st ; inv'             #script mode
Examples, multimode:
 * moshell -m rnc11,10.1.128.17,rbs33.ericsson.se
 * moshell -m rbslist.txt 'lt all; kget'
Examples, sql mode:
 * moshell -d ~/moshell_logfiles/logs_moshell/dcg/RNC11/RNC11_cvfinal.zip
 * moshell -d ~/moshell_logfiles/logs_moshell/cv/RNC11/db.dat
Examples, YANG mode:
 * moshell -z rbs530,enb36   => connect to RCS nodes rbs530 and enb36 over the default yang port (840)
 * moshell -z vcucp@30349,vcuup@32501,vdu@30045  => connect to ADP nodes vcucp, vcuup, and vdu on the yang ports specified after the @ sign

EOF
}

function check_pathes()
{
if [ ! -d $moshelldir ] ; then  echo "" ; echo "=====================================================================" ; echo "!!!! Moshell directory not found !!!! ---> moshelldir=$moshelldir ???" ;  echo "=====================================================================" ;fi
if [[ ! $unamea = *Android ]] ; then
if [ ! -x $bash ]       ; then  echo "" ; echo "=====================================================================" ; echo "!!!! Bash not found !!!! ---------------> bash=$bash ???"               ;  echo "=====================================================================" ;fi
fi
}


##########################################################################
# END OF FUNCTIONS
##########################################################################

##########################################################################
#    START OF SHELL SCRIPT
##########################################################################

echo ""
trap 'cleanup' 0 1 2 3 15

check_pathes

gz=0
nocs=0
checkIpContact=1
multi=0
multiyang=0
dbdat=0
userVariables=""
additionalRcFile=""
noglobrc=0
nouserrc=0
amosopt=0
fastoffline=0
timeServer=""
timePort=""
# $LIB is an internal token used in ld.so. It will expand to lib for 32-bit binaries
# and lib64 for 64-bit binaries. This will allow us to use the correct timelib for each
# binary in a mixed 32/64 bit environment.
timeLib="$moshelldir/commonjars/lib/timelib/\$LIB/timelib.so"

while getopts "lv:uc:nmdo:a:eft:gx:y:w:jz" options
do
case $options in
w) mobatch_dirdate="$OPTARG"
   ;;
x) amosopt=1
   amosfile="$OPTARG"
   ;;
y) amosopt=2
   amosfile="$OPTARG"
   ;;
g) gz=1
   ;;
l) nocs=1
   ;;
v) userVariables="$OPTARG"
   ;;
c) securityOptions="$OPTARG"
   ;;
u) if [[ $unr = 1 ]] ; then unr=0 ; fi
   ;;
n) checkIpContact=0 ;;
m) if [[ $nomulti = 1 ]] ; then echo "Multimode is not allowed on this server." ; exit 1 ; fi
   multi=1 ;;
z) multi=1 ; multiyang=1 ;;   
d) dbdat=1 ;;
a) additionalRcFile="$OPTARG" ;;
e) noglobrc=1 ;;
f) nouserrc=1 ;;
j) fastoffline=1 ;;
t) if [[ $OPTARG = *:* ]]; then
	#read timeServer timePort <<<$(IFS=':'; echo $OPTARG)  #not compatible with old bash versions
	timeServer=${OPTARG%:*}
	timePort=${OPTARG#*:}
   else
	timeServer="$OPTARG"
	timePort="8123"
   fi
  ;;
esac
done
shift $(($OPTIND - 1))


logfile=0
command=0
commandfile=0
case $# in
1|2|3)
    if [[ $# -gt 1 ]] ; then
    	if test -s "$2" ; then commandfile="$2" ; else command="$2" ; fi
    	if [[ $# -gt 2 ]] ; then
    		logfile="$3"
    		if [[ $logfile = nolog ]] ; then :
    		elif [[ $unr = 3 ]] ; then :   #touch not working when running unr=3
    		elif touch $logfile && test -w $logfile && test -f $logfile ; then :
    		else echo "Unable to write to logfile: $logfile" ; exit 1
    		fi
    	#else
    	#no logfile is made by default anymore
	#	date=$(date +%y%m%d-%H%M)
	#	logfile=${logdir}/logs_monode/${date}_`basename $1`.log
	fi
    fi
    iorfile=$1 ; node_address=""
    if test -s "$iorfile" && test -f "$iorfile" ; then
        #it's a file
	node_address=`get_ip_address`
	node=`basename $iorfile`
	if [[  x$node_address = x ]] ; then
		#it's not an iorfile
		if [[ "$iorfile" = *.gz || "$iorfile" = *.zip || "$iorfile" = *.ZIP || "$iorfile" = *.GZ || "`grep -c stopfile= "$iorfile"`" > 0 || $dbdat = 1 ]] ; then
			#it's an modump or a db.dat/cv.zip
			checkIpContact=0
			node_address="OFFLINE_"`basename $iorfile`
			multi=0 ; multiyang=0
			node=$node_address
		else
			#it's not an modump, it's probably a file that has the same name as a node
		     node_address=$1
			iorfile=$tempior
			node=$node_address
		fi
	fi
    elif [[ $dbdat = 1 ]] ; then
        #we used option -d but gave wrong path to the file
	checkIpContact=0
	node_address="OFFLINE_"`basename $iorfile`
	node=$node_address
    else
    	#it's an ipaddress or dns name
        node_address=$1
	iorfile=$tempior
	node=$node_address
    fi
    ;;
0)
    checkIpContact=0
    node="OFFLINE"
    node_address="OFFLINE"
    moshell_noargs
    ;;
*)
    moshell_noargs
    exit 0
    ;;
esac

if [[ $timeServer != "" && ($multi == 1 || $dbdat == 1 || $node == "OFFLINE") ]]; then
    echo "Time server usage is not supported in multi mode, SQL mode or offline mode"
    exit 0
fi

if [[ $unr > 0 || $mosro > 0 ]] ; then
     otherfunctions="$moshelldir/other1.awk"
     if   [[ $unr = 1 ]] ; then moshell_version="$moshell_version RESTRICTED+"
     elif [[ $unr = 2 ]] ; then moshell_version="$moshell_version RESTRICTED"
     elif [[ $unr = 3 ]] ; then moshell_version="$moshell_version LIMITED"
     elif [[ $mosro = 1 ]] ; then moshell_version="$moshell_version READONLY"
     fi
elif [[ -r "$moshelldir/other.awk" ]] ; then otherfunctions="$moshelldir/other.awk"
elif [[ -r "$moshelldir/other.zip" ]] ; then
	tty -s && stty -echo
	read -e -p "Please enter password: "
	tty -s && stty echo
	if $unzip -qc -P $REPLY "$moshelldir/other.zip" > $tempother ; then
		otherfunctions=$tempother
		echo ""
	else echo -e "\nIncorrect password. Exiting..." ; exit 1
	fi
fi

cat <<EOF > $argumentfile
BEGIN{
moshell_parent_pid=$PPID
moshell_pid=$$
moshelldir="$moshelldir"
moshellrc="$moshellrc"
globmoshellrc="$globmoshellrc"
monode_command="$command"
monode_commandfile="$commandfile"
monode_logfile="$logfile"
mobatch_dirdate="$mobatch_dirdate"
gawk="$gawk"
bash="$bash"
iorfile="$iorfile"
node="$node"
node_address="$node_address"
logdir="$logdir"
moshell_version="$moshell_version"
unr=$unr
checkIpContact="$checkIpContact"
tempother="$tempother"
nocs=$nocs
securityOptions="$securityOptions"
userVariables="$userVariables"
tempdir="$tempdir"
vobsinstallation="$vobsinstallation"
multi=$multi
multiyang=$multiyang
yangcli=$yangcli
dbdat=$dbdat
filefunc="$filefunc"
additionalRcFile="$additionalRcFile"
noglobrc="$noglobrc"
nouserrc="$nouserrc"
fastoffline="$fastoffline"
perllib="$PERLLIB"
amosopt="$amosopt"
amosfile="$amosfile"
}
EOF

if [[ $LD_PRELOAD = */opt/Citrix/VDA/lib64/libctxXrandrhook.so* ]] ; then
	export LD_PRELOAD=""
fi
if [[  $timeServer != "" ]]; then
	export TIME_SERVER=$timeServer
	export TIME_PORT=$timePort
	export LD_PRELOAD=$timeLib
fi
if [[ $unamea = SunOS* && $LD_PRELOAD_32 = *libatriagetcwd_interposer.so* ]] ; then
	unset LD_PRELOAD_32
fi
#set coredumpsize to unlimited
ulimit -c unlimited 2>/dev/null
#PERLLIB is set by CPP DTE source scripts , can cause conflicts in pmr/pmx/steg
unset PERLLIB
#To avoid openssl error message "WARNING: can't open config file: /usr/local/ssl/openssl.cnf"
if [[ -z "$OPENSSL_CONF" ]] ; then touch $tempdir/openssl.cnf && export OPENSSL_CONF="$tempdir/openssl.cnf" ; fi
var1=$($moshelldir/commonjars/dYR2g7i4FMzesiSmFG$binext $moshelldir $tempdir $binext 2>/dev/null)
if [[ $var1 != "" ]] ; then var1=" -f $var1 " ; fi
if [[ $logfile != 0 && $logfile != nolog ]] ;then
	echo "Logging to file $logfile"
	echo "Logging to file $logfile" > $logfile
	#LANG=C LC_ALL=C $moshelldir/$gawkprog -f "$argumentfile" -f "$programfile" -f "$otherfunctions" -f "$funcs" -l "$filefunc" --source 'BEGIN { moshell_start() } ; END { moshell_end() }' 2>&1 | LANG=C LC_ALL=C $moshelldir/$gawkprog -v logfile=$logfile '{print ; print >> logfile ; if ($1=="$mobrowser_pid" || $1=="$pmtester_pid" || $1=="$amosrb_pid") close(logfile) ; else if ($1 == "Bye..." && NF==1) exit ; else if (pid_found != 1 && $NF ~ /^stopfile=.tmp.[0-9]+$/) { close(logfile) ; pid_found=1 }}'
	#LANG=C LC_ALL=C $moshelldir/$gawkprog -f "$argumentfile" -f "$programfile" -f "$otherfunctions" -f "$funcs" -l "$filefunc" --source 'BEGIN { moshell_start() } ; END { moshell_end() }' 2>&1 | LANG=C LC_ALL=C $moshelldir/$gawkprog -v logfile=$logfile '{print ; print >> logfile ; if ($1=="$mobrowser_pid" || $1=="$pmtester_pid" || $1=="$amosrb_pid") close(logfile) ;                                          else if (pid_found != 1 && $NF ~ /^stopfile=.tmp.[0-9]+$/) { close(logfile) ; pid_found=1 }}'
	#TR HL94683, must use tee instead of gawk otherwise exits when calling an moshell from within moshell. if not using the exit in gawk then hanging when starting a background monitor6054 from moshell. tee has both advantages, does not hang when starting background monitor6054 process and logs to file continuously without buffering
	LANG=C LC_ALL=C $moshelldir/$gawkprog $gawkopt -O -f "$argumentfile" -f "$programfile" -f "$otherfunctions" -f "$funcs" $var1 -l "$filefunc" --source 'BEGIN { moshell_start() } ; END { moshell_end() }' 2>&1 | tee -a $logfile
	echo "Output has been logged to file $logfile"
	echo "Output has been logged to file $logfile" >> $logfile
	if [[ $gz = 1 ]] ; then
		echo "Gzipping logfile to "$logfile".gz"
		gzip -f $logfile
	fi
else
	LANG=C LC_ALL=C $moshelldir/$gawkprog $gawkopt -O -f "$argumentfile" -f "$programfile" -f "$otherfunctions" -f "$funcs" $var1 -l "$filefunc" --source 'BEGIN { moshell_start() } ; END { moshell_end() }' 2>&1
fi

