• Hatching Script

    From Black Panther@77:1/102 to Netsurge on Sun Jan 12 12:47:56 2020
    Hi Netsurge,

    I haven't been very active on here for a bit, but things are finally calming down again. I'm looking at spending more time on here and other nets again.

    I did want to share a bash script that I put together for hatching out files into different networks. As I know you are also hatching files out, I thought you may have a use for it. :)

    I hope the word wrap isn't too terrible, and you can figure it out. I can always drop a copy of it into your filebox.

    snip<=-

    #!/bin/bash
    #usage: ./hatch.sh /full/path/to/file fileechoname messageechoname
    address
    printhelp(){
    printf "This script will hatch a file into the given file echo, and
    create\n"
    printf "and post an announcement into the given message echo, using the given\n"
    printf "FTN address.\n"
    printf "\n"
    printf "Usage: ./hatch.sh /full/path/to/file fileecho messageecho
    address\n"
    printf "\n"
    exit
    }

    #Check to make sure parameters are given
    case "$1" in
    "" ) printhelp;;
    esac
    case "$2" in
    "" ) printhelp;;
    esac
    case "$3" in
    "" ) printhelp;;
    esac
    case "$4" in
    "" ) printhelp;;
    esac

    #set variables
    FULLNAME=$1
    FILENAME=${FULLNAME##*/}
    FILESIZE=$(stat --printf="%s" "$FULLNAME")
    DIR=$(dirname "${FULLNAME}")
    ECHO=$2
    MESSAGEECHO=$3
    ADDRESS=$4
    DATE=$(date +'%d %B %Y %R')
    LOGDATE=$(date +'%Y%m%d')

    #change to directory the file is located in
    cd $DIR

    #Check if file exists
    if [ -f "$FILENAME" ];
    then

    #Update the date/time to when file is being hatched
    touch $FILENAME

    #create the text file for announcement
    echo "On" $DATE "Castle Rock BBS hatched out the following files:" >
    ~/mystic/rcs/hatch/header.txt
    echo >> ~/mystic/rcs/hatch/header.txt
    echo "File Echo - "$ECHO >> ~/mystic/rcs/hatch/header.txt echo >>
    ~/mystic/rcs/hatch/header.txt
    echo $FILENAME " " $FILESIZE " bytes" > ~/mystic/rcs/hatch/file.txt
    echo "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" >>
    ~/mystic/rcs/hatch/file.txt
    unzip -p $FILENAME file_id.diz > ~/mystic/rcs/hatch/desc.txt
    unzip -p $FILENAME FILE_ID.DIZ >> ~/mystic/rcs/hatch/desc.txt
    echo " " >> ~/mystic/rcs/hatch/desc.txt
    cat ~/mystic/rcs/hatch/header.txt ~/mystic/rcs/hatch/file.txt
    ~/mystic/rcs/hatch/desc.txt > ~/mystic/rcs/hatch/announce.txt

    #change to husky directory
    cd /home/dan/husky

    #hatch the file
    bin/htick -c config hatch $FULLNAME $ECHO desc @@DIZ @DIZ

    #announce the file bin/hpt -c config post -nf "CRBBS File System" -af
    "$ADDRESS" -nt "All" -at "$ADDRESS" -s "CRBBS Files Hatched" -e
    "$MESSAGEECHO" -z "`uptime -p`" -f loc ~/mystic/rcs/hatch/announce.txt

    cd /home/dan/mystic/rcs/hatch

    #create a log file
    cat announce.txt >> logs/$LOGDATE.log

    #clean up
    rm *.txt

    #run the outbound mail process
    touch /home/dan/mystic/semaphore/echomail.out
    cd /home/dan/mystic
    ./mutil msgimport.ini
    fi


    ---

    Black Panther(RCS)
    Castle Rock BBS

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Castle Rock BBS - bbs.castlerockbbs.com - (77:1/102)
  • From Netsurge@77:1/100 to Black Panther on Mon Jan 13 09:45:08 2020
    I haven't been very active on here for a bit, but things are finally calming down again. I'm looking at spending more time on here and other nets again.

    I did want to share a bash script that I put together for hatching out files into different networks. As I know you are also hatching files
    out, I thought you may have a use for it. :)

    That is awesome. Thanks!

    |15frank |08// |15netsurge
    |07disksh0p|08!|07bbs |08% |07bbs.diskshop.ca |08% |07mystic goodness |11SciNet |03ftn hq |08% |07https://scinet-ftn.org

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: % disksh0p!bbs % bbs.diskshop.ca % SciNet ftn hq % (77:1/100)