• Run Mystic on boot / RPi

    From Zero Reader@21:1/113 to All on Sunday, June 25, 2017 14:10:19
    Perhaps this has been asked/answered here before, but what would be the best method to make MIS run on boot on a Raspberry Pi?

    I always run mis with the '-d' switch. A recent power outage here reminded me that I need to make it run at boot.

    I've tried adding an @reboot line to my crontab and that doesn't seem to work.

    I've also tried adding the command to rc.local (with and without '&') to no avail.

    -ZR

    --- Mystic BBS v1.12 A34 (Raspberry Pi/32)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Monday, June 26, 2017 10:30:00
    Zero Reader wrote to All <=-

    I've also tried adding the command to rc.local (with and without '&')
    to no avail.

    OK, this is what I do (and it works).

    In /etc/rc.local

    /usr/local/bin/start-mystic

    Contents of start-mystic
    ===
    #!/bin/bash

    rm -f /tmp/upgrade # Used by semi-automatic upgrade process
    cd /mystic
    ./mis -d
    ./mis2 DAEMON
    ===

    In /etc/crontab
    ===
    # Check that MIS2 is running and restart if necessary
    * * * * * root /usr/local/bin/check-mystic
    ===

    Contents of check-mystic
    ===
    #!/bin/bash

    MYSTIC="/mystic" # Path to Mystic installation MIS2_OPTS="DAEMON" # Command line options for MIS2
    MIS_OPTS="-d"
    UPGRADE=/tmp/upgrade # Need a flag to tell the script if we are upgrading Mystic.
    if [ -f $UPGRADE ]; then exit 0 ; fi # If we are upgrading Mystic, then abort. PID=`/bin/pidof mis` # Determine if MIS is running.
    if [ "$PID" = "" ]; then # MIS has crashed, we will have to fix this!
    cd $MYSTIC
    rm -f semaphore/mis.bsy
    ./mis $MIS_OPTS
    fi
    PID2=`/bin/pidof mis2` # Determine if MIS2 is running.
    if [ "$PID2" = "" ]; then # MIS2 has crashed, we will have to fix this!
    cd $MYSTIC
    rm -f semaphore/mis2.bsy
    ./mis2 $MIS2_OPTS
    fi
    ===

    My system has been pretty robust.


    ... A kid with a hammer will find that everything he sees needs pounding.
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)
  • From Zero Reader@21:1/113 to Vk3jed on Sunday, June 25, 2017 21:28:25
    On 06/26/17, Vk3jed said the following...

    Zero Reader wrote to All <=-

    I've also tried adding the command to rc.local (with and without '&') to no avail.

    OK, this is what I do (and it works).

    In /etc/rc.local


    Thanks a million Tony! I'm going to give this a shot. I just extracted this
    and will save if needed later. Great stuff!

    73!

    -ZR

    --- Mystic BBS v1.12 A34 (Raspberry Pi/32)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Monday, June 26, 2017 11:41:00
    Zero Reader wrote to Vk3jed <=-

    Thanks a million Tony! I'm going to give this a shot. I just extracted this and will save if needed later. Great stuff!

    Good luck. You can do it on the crontab alone (which also restarts MIS/MIS2 if they crash), if you want. I can also post the upgrade script, which I use to do the initial stages of an upgrade between versions (after this, manual tweaks according to the documentation are often required).


    ... If at first you don't succeed, redefine success.
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)
  • From Zero Reader@21:1/113 to Vk3jed on Sunday, June 25, 2017 22:15:08
    On 06/26/17, Vk3jed said the following...

    Good luck. You can do it on the crontab alone (which also restarts MIS/MIS2 if they crash), if you want. I can also post the upgrade
    script, which I use to do the initial stages of an upgrade between versions (after this, manual tweaks according to the documentation are

    Already installed everything. Thanks again!

    -ZR

    --- Mystic BBS v1.12 A34 (Raspberry Pi/32)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Monday, June 26, 2017 12:26:00
    Zero Reader wrote to Vk3jed <=-

    Already installed everything. Thanks again!

    All working? :)


    ... When it come to giving, some people stop at nothing.
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)
  • From Zero Reader@21:1/113 to Vk3jed on Sunday, June 25, 2017 23:24:03
    On 06/26/17, Vk3jed said the following...

    Zero Reader wrote to Vk3jed <=-

    Already installed everything. Thanks again!

    All working? :)

    Indeed it is!

    --- Mystic BBS v1.12 A34 (Raspberry Pi/32)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Monday, June 26, 2017 15:57:00
    Zero Reader wrote to Vk3jed <=-

    All working? :)

    Indeed it is!

    Awesome. :) Do you want my upgrade script too? I use it to automate the file copying phase of an upgrade, as well as automatically disable the check for whether Mystic is running (so it doesn't get restarted in the middle of an upgrade!). I don't handle simple but tedious tasks well, so I automated that phase. :)


    ... Are the taglines too long, or is the tagline-space to sh
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)
  • From Zero Reader@21:1/113 to Vk3jed on Monday, June 26, 2017 09:29:55
    On 06/26/17, Vk3jed said the following...

    Awesome. :) Do you want my upgrade script too? I use it to automate
    the file copying phase of an upgrade, as well as automatically disable
    the check for whether Mystic is running (so it doesn't get restarted in the middle of an upgrade!). I don't handle simple but tedious tasks
    well, so I automated that phase. :)

    Well hey if you're offering it! Sure I'd love to check it out.

    -ZR

    --- Mystic BBS v1.12 A34 (Raspberry Pi/32)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Tuesday, June 27, 2017 08:59:00
    Zero Reader wrote to Vk3jed <=-

    @MSGID: <59510E03.3984.fsx_mys@freeway.apana.org.au>
    @TZ: 40f0
    On 06/26/17, Vk3jed said the following...

    Awesome. :) Do you want my upgrade script too? I use it to automate
    the file copying phase of an upgrade, as well as automatically disable
    the check for whether Mystic is running (so it doesn't get restarted in the middle of an upgrade!). I don't handle simple but tedious tasks
    well, so I automated that phase. :)

    Well hey if you're offering it! Sure I'd love to check it out.

    Sure, here it is. :) I've tried to put as many safety checks as possible into the script, so you don't accidentally trash something, especially your BBS! :) Change the variables near the top of the script to suit your environment. If not running on a Debian based distro, you may also need to find the correct location of pidof. I wrote this on Raspian Wheezy.

    #!/bin/bash

    if [ "$1" = "" ]; then
    echo "Usage: $0 <path to new mystic version>"
    exit 1
    fi

    if ! [ -d $1 ]; then
    echo "Path $1 not found or is not a directory!"
    exit 1
    fi

    DIR=$1 # Path to upgrade files (specified on command line) USER="mystic" # User that owns the Mystic installation
    GROUP="mystic" # Group that owns the Mystic installation MYSTIC="/mystic" # Path to running Mystic installation
    if ! [ -f $DIR/mystic ]; then
    echo "Directory $DIR does not appear to be a Mystic distribution!"
    exit 1
    fi

    if [ -d $DIR/mystic ]; then
    echo "Directory $DIR does not appear to be a Mystic distribution!"
    exit 1
    fi

    if ! [ -x $DIR/mystic ]; then
    echo "Directory $DIR does not appear to be a Mystic distribution!"
    exit 1
    fi

    MIS=`/bin/pidof mis`
    MIS2=`/bin/pidof mis2`
    echo $MIS $MIS2
    if ! [ "$MIS" = "" ]; then
    echo "MIS is still running, terminating..."
    kill $MIS
    fi
    if ! [ "$MIS2" = "" ]; then
    echo "MIS is still running, terminating..."
    kill $MIS2
    fi
    sleep 5
    MIS=`/bin/pidof mis`
    MIS2=`/bin/pidof mis2`
    echo $MIS $MIS2
    if ! [ "$MIS" = "" ]; then
    echo "MIS is stuck, aborting. Please fix this manually."
    exit 1
    fi
    if ! [ "$MIS2" = "" ]; then
    echo "MIS2 is stuck, aborting. Please fix this manually."
    exit 1
    fi
    touch /tmp/upgrade
    echo -n "Backing up Mystic installation..."
    rm -rf /backup/mystic.2
    mv /backup/mystic.1 /backup/mystic.2
    mv /backup/mystic /backup/mystic.1
    cp -aR $MYSTIC /backup
    echo "done!"

    echo -n "Upgrading Mystic binaries..."
    cp $DIR/mystic $MYSTIC
    cp $DIR/mis $MYSTIC
    cp $DIR/fidopoll $MYSTIC
    cp $DIR/mutil $MYSTIC
    cp $DIR/mbbsutil $MYSTIC
    cp $DIR/nodespy $MYSTIC
    cp $DIR/qwkpoll $MYSTIC
    cp $DIR/upgrade $MYSTIC
    cp $DIR/mis2 $MYSTIC
    cp $DIR/scripts/mplc $MYSTIC/scripts
    cp $DIR/scripts/mide $MYSTIC/scripts
    chown -R $USER.$GROUP $MYSTIC
    echo "done!"

    echo "Basic file copying done. Upgrade is NOT complete! Refer to upgrade.txt from your Mystic distribution for further instructions, before restarting Mystic."

    ... Nothing is foolproof. Fools are too ingenious.
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)
  • From Zero Reader@21:1/113 to Vk3jed on Monday, June 26, 2017 20:57:49
    On 06/27/17, Vk3jed said the following...

    Sure, here it is. :) I've tried to put as many safety checks as
    possible into the script, so you don't accidentally trash something, especially your BBS! :) Change the variables near the top of the script
    to suit your environment. If not running on a Debian based distro, you

    Awesome. Looks good. I just saved it out and will play with it later!

    -ZR

    --- Mystic BBS v1.12 A31 (Raspberry Pi)
    * Origin: Alcoholiday / Est. 1995 / alco.bbs.io (21:1/113)
  • From Vk3jed@21:1/109 to Zero Reader on Tuesday, June 27, 2017 11:28:00
    Zero Reader wrote to Vk3jed <=-

    Awesome. Looks good. I just saved it out and will play with it later!

    Enjoy. Yeah it does the trick for me, and as idiot proof as I could make it.
    D


    ... My opinions are my own; mistakes are the computer's fault.
    --- MultiMail/Win32 v0.49
    * Origin: Freeway BBS - freeway.apana.org.au (21:1/109)