RSS tracker added. Requires xmlstarlet.

This commit is contained in:
Storm Dragon committed 2026-07-13 15:19:28 -04:00
1 parent 5e749af65b
commit 13d44cf55e
5 files changed
+610

No files matched your search

+27
View File
@@ -25,6 +25,7 @@ check_config_files() {
"response/exit.txt:response/exit.txt.example"
"triggers/greet/greetings.txt:triggers/greet/greetings.txt.example"
"triggers/keywords/keywords.cfg:triggers/keywords/keywords.cfg.example"
"services/rss/rss.conf:services/rss/rss.conf.example"
)
for entry in "${configFiles[@]}"; do
@@ -201,6 +202,29 @@ start_ping_monitor() {
pingMonitorPid=$!
}
# Function to stop RSS service process
stop_rss_service() {
if [[ -n "$rssServicePid" ]] && kill -0 "$rssServicePid" 2>/dev/null; then
kill "$rssServicePid" 2>/dev/null
wait "$rssServicePid" 2>/dev/null
fi
}
# Start background RSS service process
start_rss_service() {
if [[ ! -x "./services/rss/rss.sh" ]]; then
return
fi
if [[ ${#channels[@]} -eq 0 ]]; then
return
fi
stop_rss_service
"./services/rss/rss.sh" "$input" "$log" "$dateFormat" "${channels[@]}" &
rssServicePid=$!
}
# Function to trim log file to prevent unbounded growth
# Keeps log between 800-1000 lines by trimming oldest entries when limit reached
trim_log() {
@@ -225,6 +249,7 @@ trim_log() {
# Trap exiting from the program to remove the temporary input file and stop ping monitor
cleanup_on_exit() {
stop_rss_service
stop_ping_monitor
rm_input
}
@@ -261,6 +286,7 @@ while true; do
# Start ping monitor for this connection
start_ping_monitor
start_rss_service
tail -f "$input" | socat -,ignoreeof "$socatAddress" | while read -r result ; do
# Strip carriage return from IRC protocol (CRLF line endings)
@@ -471,6 +497,7 @@ while true; do
# If we reach here, the connection was dropped
# Stop the ping monitor for this connection
stop_rss_service
stop_ping_monitor
# Check if this was an intentional exit