Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
ddns-route
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ddns-route
Commits
f8bbb6df
Commit
f8bbb6df
authored
Feb 02, 2020
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
0 deletions
+40
-0
Dockerfile
Dockerfile
+10
-0
ddns-route.sh
ddns-route.sh
+30
-0
No files found.
Dockerfile
0 → 100644
View file @
f8bbb6df
FROM
debian
RUN
apt update
&&
apt
install
-y
\
dnsutils
\
&&
rm
-rf
/var/lib/apt/lists/
*
WORKDIR
/usr/src/app
COPY
ddns-route.sh .
CMD
["/usr/src/app/ddns-route.sh"]
ddns-route.sh
0 → 100755
View file @
f8bbb6df
#!/bin/bash
#DOMAIN=$1
#PROTO=$2
#TAIL=$3
while
:
do
EXISTING_ROUTE
=
$(
ip route |
grep
"proto
$PROTO
"
)
EXISTING
=
$(
ip route |
grep
"proto
$PROTO
"
|
awk
'{print $1}'
)
CURRENT
=
$(
dig
$DOMAIN
+short
)
if
[
$?
!=
0
]
;
then
echo
"DNS error"
exit
1
fi
echo
$EXISTING
$CURRENT
if
[
"
$EXISTING
"
==
"
$CURRENT
"
]
;
then
echo
"Same"
else
echo
"Diff"
DEL_CMD
=
"ip route del
$EXISTING_ROUTE
"
ADD_CMD
=
"ip route add
$CURRENT
proto
$PROTO
$TAIL
"
echo
$DEL_CMD
echo
$ADD_CMD
bash
-c
"
$DEL_CMD
"
bash
-c
"
$ADD_CMD
"
fi
sleep
60
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment