Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Function to Print Voting Deadline and Superblock time

Discussion in 'Masternode Guides' started by xkcd, Jul 31, 2018.

  1. xkcd

    xkcd Member

    Joined:
    Feb 19, 2017
    Messages:
    61
    Likes Received:
    40
    Trophy Points:
    58
    Dash Address:
    XrcWshofvVCpeXoZjTiYxwysV9w2szzjRr
    This guide will show you how to add a function to your shell that will print the time to the voting deadline for treasury funds and the time til the creation of the next Superblock.

    Prerequisites

    You need a running dashd that is synced to the blockchain. You also need dash-cli in your PATH environment variable. Check this with which dash-cli, if this returns an error find the location of your dash-cli and add it to your PATH variable in the file ~/.profile. You also need the command bc this is a simple text calculator. Check for it with which bc if that gives you an error install it with sudo apt install bc

    Getting Superblock

    Follow the below steps to get and test run the function.
    Code:
    cd /tmp/
    git clone https://github.com/kxcd/superblock
    cd superblock
    chmod a+x superblock.sh
    ./superblock.sh
    
    Example output.

    upload_2018-7-31_18-24-49.png

    Installation

    If the above worked and you got an output similar to mine, great, proceed with the below to make the function run whenever you login or whenever you invoke it directly with the superblock command

    Code:
    head -n -2 superblock.sh |tail -n +3 >> ~/.bashrc
    echo -e "\nsuperblock\n" >> ~/.profile
    
    Now we test it again first try via SSH, type in the below and enter your password to ssh to the machine and login again.
    Code:
    ssh localhost
    
    upload_2018-7-31_18-30-12.png

    See the message appearing on my terminal there?

    Now let's try via the sudo command. Replace dash with your username.

    Code:
    sudo su - dash
    upload_2018-7-31_18-32-45.png

    In this case, you only see the superblock message, this is because when you su it does not process the motd scripts.

    That's it, you're done! Leave me a comment if you like this guide or have an questions, you can also find me on Discord (xkcd#7307) if you wish to chat in realtime.
     
    • Like Like x 2
    • Winner Winner x 1

Share This Page