Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement on the sys-ssh-jump service #45

Open
iTosun opened this issue Jun 9, 2021 · 1 comment
Open

Improvement on the sys-ssh-jump service #45

iTosun opened this issue Jun 9, 2021 · 1 comment

Comments

@iTosun
Copy link

iTosun commented Jun 9, 2021

I got some improvements on the sys-ssh-jump service, I like to share this for improvement of the repo. The improvement will make sleeps obsolete and it will just wait for internet connection. Also added an extra function that seemed handy in my case because i used a USB LTE modem that sometimes lost it's connectivity and needed a power cycle. The following project is used for that https://github.com/mvp/uhubctl (Also installable with apt-get)

function is_online() {
    echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1

    if [ $? -eq 0 ]; then
        echo "Redpi has internet"
        result=1
    else
        result=0
    fi
}

function wait_for_internet() {
    is_online
    while [ $result -eq 0 ]; do
        is_online
    done
}

function reset_usb_lte() {
    is_online
    if [ $result -eq 0 ];then
        # Power cycle the usb ports on the pi
        uhubctl -a 2 -l 2
        # Loop till we got internet
        wait_for_internet
    fi
}
@unixabg
Copy link
Owner

unixabg commented Jun 16, 2021

Greetings,
First thank you for the submission. Second could you checkout the next-4.x branch and make a pull request (pr) so I can see exactly how you applied these. The pr will allow for easy integration, testing, and will clearly give you credit for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants