File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 4
4
USERNAME=username
5
5
PASSWORD=password
6
6
HOST=hostsite
7
- DIR=dir
8
- CIPFILE=$DIR /current_ip
9
- USERAGENT=
" Simple bash noip updater /0.2 [email protected] "
7
+ LOGFILE=logdir/noip.log
8
+ CIPFILE=dir /current_ip
9
+ USERAGENT=
" Simple Bash No-IP Updater /0.3 [email protected] "
10
10
11
11
if [ ! -e $CIPFILE ]
12
12
then
@@ -17,11 +17,16 @@ IP=$(wget -O - -q http://www.whatismyip.org/)
17
17
CIP=$( cat $CIPFILE )
18
18
19
19
if [ " $IP " != " $CIP " ]
20
- then
21
- LOGFILE=$DIR /$( date +" %Y%m%d" ) _noip_updater.log
22
- wget -O " $LOGFILE " -q --user-agent=" $USERAGENT " --no-check-certificate " https://$USERNAME :$PASSWORD @dynupdate.no-ip.com/nic/update?hostname=$HOST &myip=$IP "
20
+ then
21
+ RESULT=$( wget -O " $LOGFILE " -q --user-agent=" $USERAGENT " --no-check-certificate " https://$USERNAME :$PASSWORD @dynupdate.no-ip.com/nic/update?hostname=$HOST &myip=$IP " )
22
+
23
+ LOGLINE=" [$( date +" %Y-%m-%d %H:%M:%S" ) ] $RESULT "
23
24
echo $IP > $CIPFILE
25
+ else
26
+ LOGLINE=" [$( date +" %Y-%m-%d %H:%M:%S" ) ] No IP change"
24
27
fi
25
28
29
+ echo $LOGLINE >> $LOGFILE
30
+
26
31
exit 0
27
32
You can’t perform that action at this time.
0 commit comments