OpenVPN client notification (connected/disconnected)

Here is my scripts with different formating , with “echo -e” ,"\n" instead of “\n”

up
#!/bin/bash
message="$(echo -e "${common_name} connected      to: ${HOSTNAME} \\nRemote:  ${untrusted_ip} \\nVirtual: ${ifconfig_pool_remote_ip}")"
/usr/bin/create_notification -s news "${message}"
/usr/bin/notifier
down
#!/bin/bash
message="$(echo -e "${common_name} disconnected from: ${HOSTNAME} \\nRemote:  ${untrusted_ip} \\nVirtual: ${ifconfig_pool_remote_ip}")"
/usr/bin/create_notification -s news "${message}"
/usr/bin/notifier
2 Likes