MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Unix Fortune



  • We already have the awesome MMM-Fortune module. Are you aware there’s a “fortune” command in unix/linux? You can install it in your pi like so:

    sudo apt install fortune
    

    It was intended to present a little epigram every time you log in to a terminal, but it can also be invoked at the command line.
    Screen Shot 2020-09-23 at 1.47.19 PM.png
    I’d be inclined to replace the “Compliments” module with a module that pulls a short unix fortune using this command, updating on a configurable interval.

    Any takers? 🙂


  • Project Sponsor Module Developer

    @spblat said in Unix Fortune:

    We already have the awesome MMM-Fortune module.

    Thank you for your kind words

    Are you aware there’s a “fortune” command in unix/linux?

    I was not.

    a module that pulls a short unix fortune using this command, updating on a configurable interval

    I put something together for you based on your request (and your kind words). User @sdetweil got the data over from the terminal to the module for me. (He’s awesome).

    I took the liberty of naming it something unique. UnixFortune wasn’t doing it for me. FortuneUnix was no better but the combination was cool. At least, I think so.

    https://github.com/mykle1/MMM-Fortunix

    Pass along some help to someone that knows less than you



  • Epic! I’ll start playing with this. During my tests I will experiment with the “-s” and “-n” command line flags for adjusting fortune length and propose/submit updates. Thank you for putting this together!


  • Project Sponsor Module Developer

    @spblat said in Unix Fortune:

    Thank you for putting this together!

    Not a big deal. I was looking for something to play with. However, you are welcome. Enjoy the module.

    Peace!


  • Project Sponsor Module Developer

    @spblat said in Unix Fortune:

    Epic! I’ll start playing with this. During my tests I will experiment with the “-s” and “-n” command line flags for adjusting fortune length and propose/submit updates. Thank you for putting this together!

    You can just fork the module and do anything you want with it 🙂



  • @Mykle1

    I found a small bug that causes some issues, at least when running on armbian and starting up via cron . It might be that ‘stock’ armbian isn’t properly setting up the $PATH as X starts. I tested against rasbian and this issue does not appear, and the ‘fix’ to add the full path to fortune (which really should always be done).

    node_helper.js (line 20)

    • exec(‘fortune -s’, (error, stdout, stderr) => {
    • exec(’/usr/games/fortune -s’, (error, stdout, stderr) => {

Log in to reply