开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

g2_link and monlink


 

Here is a challenge…

If g2_link is running with dplus, we want to make sure that a repeater module is not connected to both an REFxxxy reflector at the same time as connected to XRFxxxy. There is a blocking mechanism in place to keep an RF user from connecting to REFxxx or XRFxxx if there is an existing connection to either already in place. But, we noticed in the past that that blocking mechanism is ignored when a command line connection request is made, i.e., monlink will restore an REFxxxy connection when an XRFxxxy connection is already in place. Monlink does not know to check the RPT_STATUS.txt to see if it is empty.

Maybe the easiest way is to suspend monlink while g2_link has an active connection… RPT_STATUS.txt is not zero/0? That might be OK for a single repeater module system… but maybe a multiple module system has a dplus reflector on one module and an XRF/XLX/DCS on the other?

Maybe abandon monlink and use a bash script and cron jobs to do what monlink did for dplus?

Any thoughts?

Terry M Stader KA8SCP
WB1GOF Repeaters Proprietor

--
Terry Stader - KA8SCP
D-STAR Gateway & Reflector Admin


 

Here is an idea on this issue. Created a bash script that checks the size of a specified file. If the file size is not zero, it stops a specified service. If the file size is zero, it checks the status of the service, and if the service is stopped, it starts the service. The script also logs actions to a log file.
?
[root@wb1gof my_scripts]# cat monlink_g2link_check.sh
=========================================
#!/bin/bash
# Script to check file size and manage service status
# Configuration
FILE_PATH="/root/g2_link/RPT_STATUS.txt" ?# Change this to the file you want to check
SERVICE_NAME="monlink" ? ? ?# Change this to your service name
LOG_FILE="/var/log/monlink_g2_link_check.log" ?# Change this to your desired log file location
# Function to log messages
log_message() {
? ? local message="$1"
? ? echo "$(date '+%Y-%m-%d %H:%M:%S') - $message" >> "$LOG_FILE"
}
# Check if the file exists
if [ ! -f "$FILE_PATH" ]; then
? ? log_message "Error: File '$FILE_PATH' does not exist."
? ? exit 1
fi
# Get the file size
FILE_SIZE=$(stat -c%s "$FILE_PATH")
# Check if the file size is not zero
if [ "$FILE_SIZE" -ne 0 ]; then
? ? log_message "File size is not zero ($FILE_SIZE bytes). Stopping service '$SERVICE_NAME'."
? ? systemctl stop "$SERVICE_NAME"
? ? if [ $? -eq 0 ]; then
? ? ? ? log_message "Service '$SERVICE_NAME' stopped successfully."
? ? else
? ? ? ? log_message "Error: Failed to stop service '$SERVICE_NAME'."
? ? ? ? exit 1
? ? fi
else
? ? log_message "File size is zero. Checking status of service '$SERVICE_NAME'."
? ? SERVICE_STATUS=$(systemctl is-active "$SERVICE_NAME")
? ? if [ "$SERVICE_STATUS" = "inactive" ]; then
? ? ? ? log_message "Service '$SERVICE_NAME' is stopped. Starting service."
? ? ? ? systemctl start "$SERVICE_NAME"
? ? ? ? if [ $? -eq 0 ]; then
? ? ? ? ? ? log_message "Service '$SERVICE_NAME' started successfully."
? ? ? ? else
? ? ? ? ? ? log_message "Error: Failed to start service '$SERVICE_NAME'."
? ? ? ? ? ? exit 1
? ? ? ? fi
? ? else
? ? ? ? log_message "Service '$SERVICE_NAME' is already running."
? ? fi
fi
exit 0
=========================================
Not sure what is wrong just yet... but when I check the RPT_STATUS.txt file size with an ls -l, it shows 0 but the script says it is not empty?
-rw-r--r-- 1 root root ? ? ? 0 Apr ?1 13:52 RPT_STATUS.txt
?
2025-04-01 13:52:01 - File size is not zero (38 bytes). Stopping service 'monlink'.
2025-04-01 13:52:01 - Service 'monlink' stopped successfully.
?
Maybe the way I check the file size?
?
Terry
?
?
--
Terry Stader - KA8SCP
D-STAR Gateway & Reflector Admin