Set window title in tmux or screen to the hostname you are connecting by ssh

To set the window title in tmux or screen to the hostname you are connecting by ssh, add this to your ~/.bashrc:

settitle() {
    printf "\033k$1\033\\"
}

ssh() {
    local sshargs=("$@")
    local do_settitle=1
    tty -s || local do_settitle=0
    if [ "${TERM:0:6}" != "screen" ]; then
        local do_settitle=0
    fi
    if [ $do_settitle -eq 1 ]; then
        if [ "$1" == "-l" ]; then
            shift 2
        fi
       settitle "$*"
    fi
    command ssh "${sshargs[@]}"
    if [ $do_settitle -eq 1 ]; then
        settitle "bash"
    fi
}

Monitor Salicru SPS SOHO+ UPS with NUT

I’ve successfully monitored a Salicru SPS SOHO+ UPS with NUT following these steps.

In this example I have two Fedora servers, a master where the UPS is connected by USB and a client which is also powered by this UPS but monitors its status by network. With the default configuration the clients will be powered down in an outage when the battery reaches critical levels.

Continue reading Monitor Salicru SPS SOHO+ UPS with NUT