• New Files Announcements w/SBBS

    From Ray Quinn@1:103/705 to All on Sat Feb 5 21:13:26 2022
    I have been working to switch from HTICK to TICKIT and so far it hasn't
    been too difficult. One thing I used with HTICK was the ability to do file announcements. I have been searching for documentation on having that
    ability with one of the modules in Syncronet. Not finding anything, I came
    up with the script below to do just that. Please don't laugh as I am no
    where near a programmer. I welcome constructive criticism and suggestions
    as to how to make it more streamlined. I am sure combining the text files
    as I do here can be done more simply than using cat, or even more simply
    using cat, but I haven't found it yet.

    (I am running Debian Stretch)


    #!/bin/bash
    # Script written by Ray Quinn W6RAY February 5, 2022
    # Script to create a new files list and announce into selected message
    # areas
    # Set environment variables
    export SBBSCTRL=/sbbs/ctrl
    cd /sbbs/text
    # Running the filelist javascript to get the files over the
    # past day and putting them into a text file
    jsexec filelist -all -hdr -i -ext -pad -new=1 > /sbbs/text/todaysfiles.txt
    # Getting the current date and time.
    date -R > date.txt
    # Combining the files for a new files list for posting.

    cat todaysfiles.hdr date.txt todaysfiles.space todaysfiles.txt
    todaysfiles.ftr > us99newfiles.txt
    (^These two lines are actually one)

    # Entering the new files list into message area(s).

    smbutil -tAll -f"US 99 File Ticker" -s"New Files at US 99 BBS Today" i/sbbs/text/us99newfiles.txt /sbbs/data/subs/net214214test.shd
    (^These two lines are actually one)

    etc...
    etc...


    todaysfiles.hdr & .ftr is the header and footer. date.txt inserts the date. todaysfiles.space just inserts some custom spacing. todaysfiles.txt is the actual output from jsexec filelist.


    Thanks



    ---
    þ Synchronet þ US 99 BBS - Visalia, CA - bbs.quinnnet.org
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to Ray Quinn on Sat Feb 5 22:41:24 2022
    Re: New Files Announcements w/SBBS
    By: Ray Quinn to All on Sat Feb 05 2022 09:13 pm

    smbutil -tAll -f"US 99 File Ticker" -s"New Files at US 99 BBS Today" i/sbbs/text/us99newfiles.txt /sbbs/data/subs/net214214test.shd
    (^These two lines are actually one)

    postmsg.js is the preferred method of adding messages to a message base these days, but the smbutil method should still work.
    --
    digital man (rob)

    This Is Spinal Tap quote #3:
    How much more black could this be? and the answer is none. None more black. Norco, CA WX: 62.7øF, 18.0% humidity, 1 mph WSW wind, 0.00 inches rain/24hrs --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Ray Quinn@1:103/705 to Digital Man on Sun Feb 6 13:05:42 2022
    postmsg.js is the preferred method of adding messages to a message base these days, but the smbutil method should still work.

    I didn't even see that one. Made the change. Thanks.

    On a related note: (Probably not really Synchronet specific) Where would I find the proper language to add to the script so as to not create the message should there be no new files listed in the time frame, in this case - 1 day? I don't wish to send out an empty message with just the header, date, and footer.

    ---

    If the right side of the brain controls the left side of the body,
    then only left handed people are in their right minds.


    73 de Ray Quinn W6RAY
    GMRS WRKZ506
    Visalia, CA USA DM06ii
    When all else fails, ham radio works!

    ---
    þ Synchronet þ US 99 BBS - Visalia, CA - bbs.quinnnet.org
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Digital Man@1:103/705 to Ray Quinn on Sun Feb 6 16:03:54 2022
    Re: New Files Announcements w/SBBS
    By: Ray Quinn to Digital Man on Sun Feb 06 2022 01:05 pm

    On a related note: (Probably not really Synchronet specific) Where would I find the proper language to add to the script so as to not create the message should there be no new files listed in the time frame, in this case - 1 day? I don't wish to send out an empty message with just the header, date, and footer.

    https://www.geeksforgeeks.org/shell-script-to-measure-size-of-a-file/

    You probably want to store the file size (using stat or wc) in a script variable and then compare it to 0.
    --
    digital man (rob)

    This Is Spinal Tap quote #33:
    Nigel Tufnel: Well, so what? What's wrong with bein' sexy?
    Norco, CA WX: 76.2øF, 11.0% humidity, 7 mph N wind, 0.00 inches rain/24hrs
    --- SBBSecho 3.14-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Ray Quinn@1:214/23 to Digital Man on Sun Feb 13 20:34:06 2022
    Hello Digital!

    06 Feb 22 16:03, you wrote to me:

    Re: New Files Announcements w/SBBS
    By: Ray Quinn to Digital Man on Sun Feb 06 2022 01:05 pm

    On a related note: (Probably not really Synchronet specific) Where
    would I find the proper language to add to the script so as to not
    create the message should there be no new files listed in the time
    frame, in this case - 1 day? I don't wish to send out an empty
    message with just the header, date, and footer.

    https://www.geeksforgeeks.org/shell-script-to-measure-size-of-a-file/

    You probably want to store the file size (using stat or wc) in a
    script variable and then compare it to 0.

    I should have mentioned that I have never really done any programming. A few .bat files over the years, and lately some BASH scripts. I recently watched your Youtube video where you created the email file java script "module". I may want to start looking into doing things similar, provided I have an idea worth scripting.

    I say that to lead to this: I followed the link above and was able to figure out how to accomplish my task. I appreciate it more than you know.

    Feel free to critique my work. Here is what I came up with:

    $SBBSEXEC/jsexec filelist -all -hdr -i -ext -pad -new=1 > $filepath
    # Checking for empty file and exiting. We don't want to send out empty messages.
    size=$(wc --bytes < $filepath)
    echo " $(date +%B-%d-%Y-%T) Today's new files list file is $size Bytes" >> $logfile
    if [ $size == 0 ]
    then echo " $(date +%B-%d-%Y-%T) No new files today." >> $logfile ; exit
    else

    then the cat command I posted earlier to post the announcements. Seems to be working.

    Again, thanks!

    73 de W6RAY Ray Quinn


    --- GoldED+/W64-MSVC 1.1.5-b20180707
    * Origin: Ham Radio operators do it with frequency! (1:214/23)