bash script for the NETCAT connection test to a SAP S/4HANA system
The script is useful for automated monitoring of SAP system connectivity and logging connection events, making it ideal for system administrators to ensure the availability and integrity of their SAP systems. The Bash script checks the connection to a MessageServer of a SAP system instance. Here is a summary of its functionalities:
Connection Test: The script tests the nc connection to a MessageServer of a SAP system instance. It utilizes the check_connection function to perform the connection check.
Logging: The script logs the test results in two files: connectiontest.txt contains all test results, while connectiontest-failed.txt stores only failed connection attempts.
Notification on Connection Failures: In case of a connection failure, the script sends an email notification to the specified email address.
Cleanup of Old Entries: The script deletes old timestamps from the connectiontest.txt log file after 10 days to maintain file cleanliness and save storage space.
Endless Loop for Periodic Testing: The script includes a commented-out endless loop that performs connection tests at regular intervals. This feature can be enabled to continuously monitor the connection. It is recommended to set up a cronjob for this purpose.
Termination of nc Sessions: Upon completion of the script, it terminates all running nc sessions belonging to the current user.
bash script for the NETCAT connection test to a SAP S/4HANA system Read More »
