forked from netzfisch/rpi-dyndns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit
28 lines (24 loc) · 1.04 KB
/
init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/ash
# init script to start ddclient
# exit at failure with '1'!
set -e
UPDATE_TOKEN=`cat /run/secrets/ddclient.password`
if [ -f /run/secrets/ddclient.password ]
then
UPDATE_TOKEN=`cat /run/secrets/ddclient.password`
fi
# replace credentials when starting container first time
if [ ! -f /.initialized ]; then
sed -i -e "s/@@login1@@/$HOSTNAME1/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@password1@@/$UPDATE_TOKEN1/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@hostname1@@/$HOSTNAME1/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@login2@@/$HOSTNAME2/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@password2@@/$UPDATE_TOKEN2/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@hostname2@@/$HOSTNAME2/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@login3@@/$HOSTNAME3/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@password3@@/$UPDATE_TOKEN3/g" /etc/ddclient/ddclient.conf
sed -i -e "s/@@hostname3@@/$HOSTNAME3/g" /etc/ddclient/ddclient.conf
touch /.initialized
fi
# start ddclient
ddclient -daemon=300 -foreground -noquiet