Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Peter 8:05 pm on January 1, 2018 Permalink | Reply  

    Upgrading Ubuntu 13.10 to 16.04 LTS 

    I have a dedicated server with Kimsufi that I recently upgraded from Ubuntu 13.10 to 16.04 LTS. I’m running stock Ubuntu rather than the custom OVH distribution. Some upgrade notes:

    • do-release-upgrade took care of 13.10 to 14.04 LTS pretty quickly and smoothly
    • 14.04 LTS to 16.04 LTS took a lot longer, much no errors were reported during the upgrade
    • after reading reports of eth0 being renamed to ens32 or similar, I decided to modify /etc/default/grub to make sure eth0 wouldn’t be renamed:
    GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
    
    • PHP 5 was removed during the upgrade, I did the following to remove it and and install PHP 7
    # apt-get purge php5-common
    # apt-get install libapache2-mod-php
    # service apache2 restart
    
    • once the upgrade was completed, the first reboot brought the machine back up but without network connectivity. Luckily, OVH’s monitoring alerted one of their team who had rebooted the server once more within 30 minutes, all without me needing to open a ticket. (Without that help, I was getting ready to try to Rescue Mode.) Subsequent reboots brought the machine back fully connected.
     
  • Peter 9:22 pm on December 30, 2017 Permalink | Reply  

    Setting GNU Screen title to SSH hostname 

    Adapted from: https://m0dlx.com/blog/Renaming_GNU_Screen_windows_by_SSH_remote_hostname.html

    Create ~/.ssh_hostname and chmod +x:

    #!/bin/bash
    echo -ne "\033k$1\033\\"
    

    And then add to ~/.ssh/config:

    PermitLocalCommand yes
    LocalCommand ~/.ssh_hostname %h

    This interferes with Git SSH commands, so be sure to exclude those hosts, for example:

    Host * !bitbucket.org
    PermitLocalCommand yes
    LocalCommand ~/.ssh_hostname %h
    
     
  • Peter 2:58 pm on December 20, 2017 Permalink | Reply  

    Expect SMTP Script 

    The following expect script will connect to a mailserver and attempt to send a test message. Useful for quickly troubleshooting mail issues.

    Usage: expect mail.exp mailserver from_address to_address

    #!/usr/bin/expect
    set mailserver [lrange $argv 0 0]
    set from [lrange $argv 1 1]
    set to [lrange $argv 2 2]
    
    spawn telnet $mailserver 25
    expect "failed" {
    send_user "$mailserver: connect failed\n"
    exit
    } "2?? *" {
    } "4?? *" {
    exit
    } "refused" {
    send_user "$mailserver: connect refused\n"
    exit
    } "closed" {
    send_user "$mailserver: connect closed\n"
    exit
    } timeout {
    send_user "$mailserver: connect to port 25 timeout\n"
    exit
    }
    send "HELO foo.com\r"
    expect "2?? *" {
    } "5?? *" {
    exit
    } "4?? *" {
    exit
    }
    send "MAIL FROM: <$from>\r"
    expect "2?? *" {
    } "5?? *" {
    exit
    } "4?? *" {
    exit
    }
    send "RCPT TO: <$to>\r"
    expect "2?? *" {
    } "5?? *" {
    exit
    } "4?? *" {
    exit
    }
    send "DATA\r"
    expect "3?? *" {
    } "5?? *" {
    exit
    } "4?? *" {
    exit
    }
    send "From: $from\r"
    send "To: $to\r"
    send "Subject: test\r"
    send "This is a test message\r"
    send ".\r"
    expect "2?? *" {
    } "5?? *" {
    exit
    } "4?? *" {
    exit
    }
    send "QUIT\r"
    exit
    

    Bitbucket snippet: https://bitbucket.org/snippets/pvibert/ye7eE6

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel