Subj : Re: poll.bsy
To : paulie420
From : pweck
Date : Sun Oct 20 2024 12:46 pm
On 19 Oct 2024, paulie420 said the following...
pa> pw> i know there has been posts about issues with poll.bsy hanging. so
pa> pw> instead of sticking with the most recent version, i backed down to th
pa> pw> most recent stable version and still see poll.bsy hanging a few times
pa> pw> week!
pa> pw>
pa> pw> anyway, i am running pi 32 bit and wondering if anyone has a solution
pa> pw> work-around for the ongoing issue.
pa>
pa> I wrote a script that *I* trust. Please review it for yourself, I could
pa> be an idiot and all...
pa>
thanks paulie, i will try the script out. hopefully g00r00 will find a fix in the code for it.
pweck
pa> -----
pa> $ cat bsy.sh
pa> #!/usr/bin/env bash
pa>
pa> # Mystic BBS software .bsy file manager
pa> # At times, Mystic leaves a poll.bsy, mutil.bsy, or mis.bsy file when it
pa> should # NOT be present. This script checks if fidopoll or mutil is
pa> running; if neither
pa> # process is running (meaning those .bsy files should NOT be present) -
pa> it then # checks for any .bsy files that have been present for longer
pa> than 60 minutes # and removes them if found. This helps prevent stale or
pa> orphaned .bsy files # from causing issues with the system.
pa>
pa> # Set the working directory to the Mystic installation directory
pa> WDIR="/home/pi/mystic"
pa>
pa> # Change to the working directory
pa> cd $WDIR
pa>
pa> # Check if the 'mis poll' or 'mutil' is running.
pa> # The \ps command ensures that we use the system's ps command, bypassing
pa> any # aliases. If either are running, set output to "RUNNING", otherwise
pa> set it to # "NOT RUNNING".
pa> F=$(\ps -ef | grep "mis poll" | grep -v grep >/dev/null; [ $? -gt 0 ] &&
pa> echo "NOT RUNNING" || echo "RUNNING")
pa>
pa> M=$(pidof mutil; [ $? -gt 0 ] && echo "NOT RUNNING" || echo "RUNNING")
pa>
pa> # Find all .bsy files related to Mystic that have been modified more
pa> than 60 # minutes ago. The -mmin +60 option filters for files older than
pa> 60 minutes. B=$(find . -type f -name "*.bsy" -mmin +60 | grep echomail |
pa> wc -l)
pa>
pa> # Display the status of fidopoll and mutil processes and the number of
pa> old .bsy # files found.
pa> cat << EOF
pa> Fidopoll pidof result: $F
pa> Mutil pidof result: $M
pa> Number of BSY files (older than 60 min): $B
pa> EOF
pa>
pa> # If there are any .bsy files older than 60 minutes, and neither
pa> fidopoll nor i # mutil is running, it means these .bsy files are likely
pa> orphaned and can be # safely removed.
pa> if [[ $B -gt 0 && ($F == "NOT RUNNING" && $M == "NOT RUNNING") ]]; then
pa> # Inform the user that orphaned .bsy files are being cleared.
pa> echo -e "\nClearing $B orphaned BSY files (older than 60 min)..."
pa>
pa> # Loop through each .bsy file found and remove it.
pa> for F in $(find . -type f -name "*.bsy" -mmin +60 | grep echomail); do
pa> echo "Removing: $F"; rm $F
pa> done
pa>
pa> # Run the mailout process using mutil to ensure any queued mail is
pa> processed. ./mutil mailout
pa>
pa> # Force a fidopoll to make sure the system is synchronized with other
pa> nodes. ./mis poll force
pa> fi
pa> -----
pa>
pa>
pa>
... The person who snores the loudest will fall asleep first