• Best way to restart MIS on RPi

    From Avon@21:1/101 to All on Sunday, January 07, 2018 21:08:33
    Hi guys

    I have a request from a recent YouTube clip that I posted to create a video explaining the best way to set things up on the Pi to boot MIS on reboot or crash?

    The person (who is new to Mystic) tried rc.local, bashrc and cron with no results...

    That's all I know. :)

    g00r00 do you have a 'preferred' way of doing this? If so I can build a clip for the channel to demo it :)

    Best, Paul


    `I'm not expendable, I'm not stupid, and I'm not going' - Kerr Avon, Blake's 7

    --- Mystic BBS v1.12 A38 2018/01/01 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)
  • From Static@21:2/140 to Avon on Sunday, January 07, 2018 08:06:39
    On 01/07/18, Avon said the following...

    The person (who is new to Mystic) tried rc.local, bashrc and cron with no results...

    bashrc is executed every time you start a shell and isn't appropriate for
    this task.

    You would probably want to use a persistent script that you either fork to background in rc.local/inittab/whatever-your-init-system-is or add it to your crontab with the @reboot option.

    In rc.local:
    /mystic/mislauncher.sh &
    or to run as a user:
    su mysticuser -c "/home/mysticuser/mislauncher.sh" &
    It's important to fork the script into the background with & here otherwise rc.local will never finish and complete the boot process.

    In crontab you would just prefix the command with @reboot:
    @reboot /mystic/mislauncher.sh

    example mislauncher.sh:
    ---
    #!/bin/sh
    export mysticbbs="/mystic"
    # Remove leftover mis.bsy if it exists.
    [ -f $mysticbbs/semaphore/mis.bsy ] && rm $mysticbbs/semaphore/mis.bsy
    # Run MIS until it exits. If exitcode is non-zero, log to stderr and loop. until $mysticbbs/mis server >/dev/null; do
    echo "MIS crashed and restarted. Exit code: $?" >&2
    sleep 2
    [ -f $mysticbbs/semaphore/mis.bsy ] && rm $mysticbbs/semaphore/mis.bsy
    done
    exit 0
    ---

    Note MIS is run in server mode instead of daemon in this example. This allows the script to call it as the loop command and wait for it. If launched as a daemon you would need to poll 'ps' for the PID at regular intervals instead.

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/64)
    * Origin: Subcarrier BBS (21:2/140)
  • From Accession@21:1/200 to Avon on Sunday, January 07, 2018 07:34:30
    On 01/07/18, Avon said the following...

    I have a request from a recent YouTube clip that I posted to create a video explaining the best way to set things up on the Pi to boot MIS on reboot or crash?

    It depends on which OS the person is using and whether said OS is using
    systemd or sysvinit.

    But the easiest way would be to make either a systemd startup script or sysvinit script that starts on boot, and restarts on error/crash.

    Regards,
    Nick

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/64)
    * Origin: _thePharcyde telnet://bbs.pharcyde.org (Wisconsin) (21:1/200)
  • From Nugax@21:1/107 to All on Sunday, January 07, 2018 07:51:47
    I would create a At reboot cron job to run the bbs. If you use port 23 or low port you need to edit roots cron job.

    Example:

    Add this to the first line:
    @reboot /the/Mystic/dir/start.sh

    As root user run this to edit:

    Sudo crontab -e


    This is a great way to start mystic. Another way would be to setup a job in /etc/init.d and
    Update and add to all runtimes.

    Personally, I run mine with cron.




    On 15:08 07/01 , Avon wrote:
    Hi guys

    I have a request from a recent YouTube clip that I posted to create a video >explaining the best way to set things up on the Pi to boot MIS on reboot or >crash?

    The person (who is new to Mystic) tried rc.local, bashrc and cron with no >results...

    That's all I know. :)

    g00r00 do you have a 'preferred' way of doing this? If so I can build a clip >for the channel to demo it :)

    Best, Paul


    `I'm not expendable, I'm not stupid, and I'm not going' - Kerr Avon, Blake's 7

    --- Mystic BBS v1.12 A38 2018/01/01 (Windows/32)
    * Origin: Agency BBS | Dunedin, New Zealand | agency.bbs.nz (21:1/101)


    --
    yrNews Usenet Reader for iOS
    http://appstore.com/yrNewsUsenetReader

    --- Mystic BBS/NNTP v1.12 A38 2018/01/01 (Linux/64)
    * Origin: -=The ByteXchange BBS : bbs.thebytexchange.com=- (21:1/107)
  • From CyntaxX@21:1/999 to Static on Sunday, January 07, 2018 11:37:21
    In crontab you would just prefix the command with @reboot:
    @reboot /mystic/mislauncher.sh

    I tried this as you mentioned using crontab and it starts up fine, but is
    there a way to have the terminal window popup. It currently runs in the background. I like seeing the connections/events running to make
    sure the commands are performing properly as I set things up. Or is there another way to show the mis server window while it's running in the
    background.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:1/999)
  • From Nugax@21:1/107 to All on Sunday, January 07, 2018 14:08:15
    You'd need to use rc.local i suspect. I run my in daemon

    On 05:37 07/01 , CyntaxX wrote:
    In crontab you would just prefix the command with @reboot:
    @reboot /mystic/mislauncher.sh

    I tried this as you mentioned using crontab and it starts up fine, but is >there a way to have the terminal window popup. It currently runs in the >background. I like seeing the connections/events running to make
    sure the commands are performing properly as I set things up. Or is there >another way to show the mis server window while it's running in the >background.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:1/999)


    --
    yrNews Usenet Reader for iOS
    http://appstore.com/yrNewsUsenetReader

    --- Mystic BBS/NNTP v1.12 A38 2018/01/01 (Linux/64)
    * Origin: -=The ByteXchange BBS : bbs.thebytexchange.com=- (21:1/107)
  • From CyntaxX@21:1/999 to Nugax on Sunday, January 07, 2018 15:54:12
    Ok I'll give that a go and see if that makes a difference. Worst case, if it only runs headless I'll just wait until everything is running like clockwork and then autorun the server.

    Thanks.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:1/999)
  • From Static@21:2/140 to CyntaxX on Sunday, January 07, 2018 21:05:00
    On 01/07/18, CyntaxX said the following...

    I tried this as you mentioned using crontab and it starts up fine, but is there a way to have the terminal window popup. It currently runs in the background.

    If I understand you correctly and you want to run it from within the desktop environment, then init/crontab aren't going to work. You have to launch the desktop environment first and then run the watchdog script inside there. I'm not familiar with Raspbian's DE (PIXEL?) but if it has a startup menu you
    could probably add the script there to have it launch on startup. You'll also want to remove redirections to /dev/null in the script if any so you can actually see the stdout output.

    If PIXEL follows the freedesktop.org spec then you can create a launcher icon for the script on your desktop and throw it in ~/.config/autostart/

    Mind that this will not start completely unattended unless your Pi is set up to auto-login to the desktop, since the DE must launch before the script can autostart.

    You could also run nodespy but it's not exactly the same thing as the server mode of MIS.

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/64)
    * Origin: Subcarrier BBS (21:2/140)
  • From esc@21:2/142 to Avon on Monday, January 08, 2018 07:39:00
    I have a request from a recent YouTube clip that I posted to create a video explaining the best way to set things up on the Pi to boot MIS on reboot or crash?

    *probably late to the party*

    This is contingent on the linux distro's init system, and should be part of
    the init process.

    I can provide a simple systemd method, which works well for me on debian. I should mention I run this headless in a cloud server, so it's not a user
    level thing - when the computer boots, mystic will boot. When mystic crashes, systemd will auto-relaunch.

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/32)
    * Origin: lo fidelity bbs (21:2/142)
  • From esc@21:2/142 to CyntaxX on Monday, January 08, 2018 07:41:33
    I tried this as you mentioned using crontab and it starts up fine, but is there a way to have the terminal window popup. It currently runs in the background. I like seeing the connections/events running to make
    sure the commands are performing properly as I set things up. Or is there another way to show the mis server window while it's running in the background.

    Throw it in a screen session and attach it whenever you want.

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/32)
    * Origin: lo fidelity bbs (21:2/142)
  • From CyntaxX@21:4/113 to Static on Monday, January 08, 2018 03:49:41
    If I understand you correctly and you want to run it from within the desktop environment, then init/crontab aren't going to work.

    I eventually want to boot straight to the command line and autostart mis, but for now as I'm setting up everything I wondered if it was possible to run mis with the visual output.

    I'm running raspian lite with LXDE loaded on as I'm not proficient in the command line and still learning.

    I think once I have everything automated and setup how I want it, I'll just
    run mis in daemon in crontab and be done with it.

    Thanks for the reply.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:4/113)
  • From CyntaxX@21:4/113 to esc on Monday, January 08, 2018 03:58:30
    Throw it in a screen session and attach it whenever you want.

    I'll look into this, sounds like something I'm looking for.

    Thanks.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:4/113)
  • From esc@21:2/142 to CyntaxX on Monday, January 08, 2018 09:29:38
    I eventually want to boot straight to the command line and autostart
    mis, but for now as I'm setting up everything I wondered if it was possible to run mis with the visual output.

    I use systemd (which I believe you have with raspbian) to automate and
    monitor this. I can share an init script. In fact, shortly I'll be sharing a link to some documents on github which I've written which do (in part) cover this process.

    What I do is fork mis in a screen session, so I can always attach it to
    monitor later.

    I think once I have everything automated and setup how I want it, I'll just run mis in daemon in crontab and be done with it.

    I think it's better to run in server mode. I don't really like daemonizing, since screen is such a lightweight utility, it makes sense to take advantage.

    --- Mystic BBS v1.12 A38 2018/01/01 (Linux/32)
    * Origin: lo fidelity bbs (21:2/142)
  • From CyntaxX@21:4/113 to esc on Monday, January 08, 2018 19:12:50
    I use systemd (which I believe you have with raspbian) to automate and monitor this. I can share an init script. In fact, shortly I'll be
    sharing a link to some documents on github which I've written which do
    (in part) cover this process.

    Sounds good, keep me in mind I'll definitely have to give it a read.

    I think it's better to run in server mode. I don't really like daemonizing, since screen is such a lightweight utility, it makes sense
    to take advantage.

    I wholeheartedly agree.

    --- Mystic BBS v1.12 A38 2018/01/01 (Raspberry Pi/32)
    * Origin: Digital Wurmhole | digitalwurmhole.ddns.net:2323 (21:4/113)