To: "test" <yourname@qnap.com>
Subject: Test mail
From: "qnap" <qnap@test.com>
Server Name: NAS
IP Address: 0.0.0.0
Date/Time: Today
This is a test mail sent by NAS.
#!/bin/bash
wget -q --spider http://google.com
if [ $? -eq 0 ]; then
[run script]
else
sleep 20
[run script]
fi
#!/bin/sh
# test if line is up
# if you can reach google, then execute the script
# otherwise wait for 30 seconds and then restart NGrok
wget -q --spider http://google.com
if [ $? != 0 ]; then
sleep 30
/etc/init.d/NGrok.sh restart
else
## use nohup and & to send ngrok in background
nohup /opt/NGrok/ngrok http -bind-tls=false -inspect=false 58000 &
# after tunnel creation sleep for 10 seconds to ensure the tunnel is created
sleep 10
# take timestamp for notification
TIMESTAMP=$(date +"%Y-%m-%d %Hh%M")
# create temp files and assign variables
CURL_NGROK="/share/homes/admin/script/ngrok/ngrok-curl.txt"
TR_NGROK="/share/homes/admin/script/ngrok/ngrok-tr.txt"
MAIL="/share/homes/admin/script/ngrok/ngrok-mail.txt"
# take raw information from ngrok monitor service
curl http://127.0.0.1:4040/api/tunnels > $CURL_NGROK
# put raw information in column (by ")
tr '"' '\n' < $CURL_NGROK > $TR_NGROK
# send output to QTS
/sbin/log_tool -a "$TIMESTAMP - Ngrok http tunnel created for `sed '24q;d' $TR_NGROK` to `sed '14q;d' $TR_NGROK`." -t 1 >&2
# send email
echo "To: "XXXXX" <XXXX@XXXXX.com>" > $MAIL
echo "To: "YYYY" <YYYY@YYYY.com>" >> $MAIL
echo "Subject: ngrok tunnel created" >> $MAIL
echo "From: "qnap" <qnap@XXX.XXX>" >> $MAIL
echo "" >> $MAIL
echo "" >> $MAIL
echo "$TIMESTAMP - Ngrok http tunnel created for `sed '24q;d' $TR_NGROK` to `sed '14q;d' $TR_NGROK`." >> $MAIL
/usr/sbin/sendmail -vvv -t < $MAIL
exit 0
fi
[<-] 220 m-r1.th.seeweb.it ESMTP Postfix (Debian/GNU)
[->] EHLO nas
[<-] 250 DSN
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
[->] HELO qnap
[<-] 250 m-r1.th.seeweb.it
[->] MAIL FROM:<qnap@XXX.XXX>
[<-] 250 2.1.0 Ok
[->] RCPT TO:<YYYY@YYYY.com>
[<-] 554 5.7.1 <YYYY@YYYY.com>: Recipient address rejected: Access denied
sendmail: RCPT TO:<YYYY@YYYY.com> (554 5.7.1 <YYYY@YYYY.com>: Recipient address rejected: Access denied)
Merci!QoolBox a dit:je viens de te faire un petit update
c'est quoi la différence?QoolBox a dit:/etc/ngrok doit pointer vers le répertoire du qpkg
Super, cela peut effectivement aider (je vais tester).QoolBox a dit:le processus se lance en 145 au lieu de 110 dans le RC num, laissant le temps au NAS de charger tout son bazard
je l'ai installé avec Entware-ng.QoolBox a dit:ou as tu chopé nohup ? il n'est pas par défaut sur le NAS
c'est cela qui est bizarre! Je vais essayer avec un seul adresse et manuellement...QoolBox a dit:Recipient address rejected: Access denied bizard le script se base sur tes info de notification de QTS
giopas a dit:mdr, tu vas du coup créer un autre paquet?
giopas a dit:merci!
j'ai vu un petit erreur dans le stop.sh scrit: ngork au lieu de ngrok