After installing/starting APMIA, seeing
"APMIA is not installed/corrupt installation is present/APMIA is started using console start."
The error is a combined message covering four distinct scenarios — it does not necessarily mean the installation is corrupted.
The script sets variable isinstall to 1 only when a service registration file is found and its recorded path matches the current $APMIA_HOME. If none of the following are found, isinstall stays 0:
Common causes: the agent was never installed via APMIACtrl.sh install, or the service registration files were manually deleted.
isinstall variable is set to 2 when a service registration file is found, but the path recorded inside it does not match the current $APMIA_HOME. This means the agent was registered from a different directory than where the script is now running. This happens when:
Since isinstall == 2 is not equal to 1, installerrmsg fires.
APP_NAME is read from APMIAgent.shconf
APP_NAME=$(grep 'APP_NAME=[^,]*' "$APMIA_AGENT_BIN_PATH/APMIAgent.shconf" | awk ...)
If APMIAgent.shconf is missing, corrupted, or the APP_NAME variable is not set in it, APP_NAME will be empty. All the service file paths like /etc/systemd/system/.service or /etc/init.d/ will resolve to empty/wrong paths, so no service is found → isinstall stays 0.
If the agent was launched using APMIACtrl.sh console_start, it runs as a foreground process without registering any service files. So the script finds nothing and isinstall remains 0.