bash

By Druss , 26 November, 2018

So I have a couple of routers connected to my network each linking to a different ISP. When an ISP goes down, I want to easily switch ISPs from the command line and these are the couple of lines I use to do so:


#!/bin/bash

sudo ip route del default

if [ $1 == 'isp1' ]
then
echo "Switching ISP to $1"
sudo ip route add default via 192.168.1.1
else
echo "Switch ISP to ISP2"
sudo ip route add default via 192.168.0.1
fi

By Druss , 25 August, 2014

So, here I was writing a script that would automate the installation of a package in Ubuntu 14.04 and all was going swimmingly. Until I ran it. You know how some apt-get installs sometimes involve a technicolor pop-up that asks you for stuff? Well, those pop-ups interrupted my script which didn't proceed further. After much digging, I found that there are a couple of solutions for this:

By Druss , 20 August, 2014

On a new Ubuntu 14.04 (Trusty) LTS server, I ran into the following:

$ su -c /bin/bash foo
bash: cannot set terminal process group (3987): Inappropriate ioctl for device
bash: no job control in this shell

However, the su procedure worked and I was logged in as user foo.

All times are UTC. All content licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.