Catching script execution failures with a semicolon

In bash shell scripting, the ; (seimicolon) is know as the command separator. It separates two commands that run sequentially, one after the other. For example: command-one; command-two.

By using the ;, we can create a watch-dog script to send out an alert if the previous command stops executing. In this example, I want to be notified if the ./ exits for any reason:

./; echo "The script ended" | mail -s "Ut oh, the script ended unexpectedly!" -S smtp=smtp:// -v

A few hours later I received an email from the watch-dog. After reviewing the console output, it looks like a login failure caused the script to crash:

Traceback (most recent call last):
  File "./", line 17, in <module>
    net_connect = Netmiko(host="", username="jemurray", password=password, device_type="cisco_ios")
  File "/usr/local/lib/python3.6/site-packages/netmiko/", line 312, in ConnectHandler
    return ConnectionClass(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/cisco/", line 17, in __init__
    return super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/netmiko/", line 346, in __init__
  File "/usr/local/lib/python3.6/site-packages/netmiko/", line 351, in _open
  File "/usr/local/lib/python3.6/site-packages/netmiko/", line 920, in establish_connection
  File "/usr/local/lib/python3.6/site-packages/paramiko/", line 446, in connect
  File "/usr/local/lib/python3.6/site-packages/paramiko/", line 764, in _auth
    raise saved_exception
  File "/usr/local/lib/python3.6/site-packages/paramiko/", line 751, in _auth
    self._transport.auth_password(username, password)
  File "/usr/local/lib/python3.6/site-packages/paramiko/", line 1509, in auth_password
    return self.auth_handler.wait_for_response(my_event)
  File "/usr/local/lib/python3.6/site-packages/paramiko/", line 250, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
Resolving host . . . done.
Connecting to . . . connected.
>>> HELO
>>> MAIL FROM:<>
250 sender <> ok
>>> RCPT TO:<>
250 recipient <> ok
>>> DATA
354 go ahead
>>> .
250 ok:  Message 22076930 accepted
>>> QUIT