Hi everyone,
I'm trying to make my ASUS RT-AC68U send an email/IFTTT trigger every time my OpenVPN connexion connect or disconnect (client side, not server).
However, I can seem to get my head around up/down triggers for an openvpn-event script.
I've manage to make two functionning email scripts (up & down):
But I can't seem to find the correct synthax required to trigger them when my VPN goes down or up.
I tried to frankenstein something from another similar post i manage to found :
But it doesn't seem to work. Any help would be welcome
ps: my coding skills are as basic as can be, so don't be afraid to dumb things down for me !
I'm trying to make my ASUS RT-AC68U send an email/IFTTT trigger every time my OpenVPN connexion connect or disconnect (client side, not server).
However, I can seem to get my head around up/down triggers for an openvpn-event script.
I've manage to make two functionning email scripts (up & down):
Code:
#!/bin/sh
echo "Subject: #OpenVPNConnect" >/tmp/mail.txt
echo "Content-Type: text/html" >>/tmp/mail.txt
echo "From: ASUS RT-AC68U" >>/tmp/mail.txt
echo "Date: `date -R`" >>/tmp/mail.txt
echo "" >>/tmp/mail.txt
echo "ASUS RT-AC68U has sucessufly connected to OpenVPN" >>/tmp/mail.txt
cat /tmp/mail.txt | sendmail -H"exec openssl s_client -quiet -CAfile /jffs/configs/Equifax_Secure_Certificate_Authority.pem -connect smtp.gmail.com:587 -tls1 -starttls smtp" -f"smtp.gmail.com" -au"mylogin" -ap"mypassword" trigger@applet.ifttt.com
rm /tmp/mail.txt
Code:
#!/bin/sh
echo "Subject: #OpenVPNDisconnect" >/tmp/mail.txt
echo "Content-Type: text/html" >>/tmp/mail.txt
echo "From: ASUS RT-AC68U" >>/tmp/mail.txt
echo "Date: `date -R`" >>/tmp/mail.txt
echo "" >>/tmp/mail.txt
echo "ASUS RT-AC68U has been disconnected from OpenVPN" >>/tmp/mail.txt
cat /tmp/mail.txt | sendmail -H"exec openssl s_client -quiet -CAfile /jffs/configs/Equifax_Secure_Certificate_Authority.pem -connect smtp.gmail.com:587 -tls1 -starttls smtp" -f"smtp.gmail.com" -au"mylogin" -ap"mypassword" trigger@applet.ifttt.com
rm /tmp/mail.txt
But I can't seem to find the correct synthax required to trigger them when my VPN goes down or up.
I tried to frankenstein something from another similar post i manage to found :
Code:
#!/bin/sh
#On openVPN connection
if [ $script_type == "up" -a $vpn_interface == "tun11" ];
then
sh /jffs/scripts/up.sh
fi
#On openVPN disconnection
if [ $script_type == "down" -a $vpn_interface == "tun11" ];
then
sh /jfss/scripts/down.sh
fi
But it doesn't seem to work. Any help would be welcome
ps: my coding skills are as basic as can be, so don't be afraid to dumb things down for me !