#!/bin/bash

# Script to reboot the 2N Intercom which tends to loose video after x hours
set -euo pipefail

reboot_2n() {
  # Read the first line of /etc/myapp/secret into $PW, **stripping** the trailing newline.
  MY_PASSWORD_FILE="$(< /root/.2n_password)"
  curl -v -k --user "$MY_PASSWORD_FILE" https://192.168.10.226/api/system/restart 
  unset -v MY_PASSWORD_FILE
}

reboot_2n "$@"
