-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.sh
More file actions
executable file
·58 lines (53 loc) · 1.85 KB
/
Copy pathconfigure.sh
File metadata and controls
executable file
·58 lines (53 loc) · 1.85 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#title :configure.sh
#description$ :Run a configuration menu to help the user to setup Ipcheck
#author :P.GINDRAUD
#author_contact :pgindraud@gmail.com
#date :2014-04-08
#usage :./ip_check.sh
#usage_info :
#options :NONE
#notes :
if [ ! -d 'ipcheckadvanced' ]; then
echo "This script must be run at the root of IpCheck folder" 1>&2
exit 1
fi
echo ' [ MENU ]'
echo ' 1) Configure for DYN UPDATE usage'
echo ' '
echo ' '
echo ' q) Quit'
echo 'Press a number'
choice=0
while [[ $choice -lt 1 || $choice -gt 1 ]]; do
read -n 1 choice
if [[ $choice = 'q' || $choice = 'Q' ]]; then exit 0; fi
done
echo -e '\n\n'
case $choice in
1)
echo ' => Downloading the dynupdate script from github'
wget -O ipcheckadvanced/resources/dynupdate.py -q https://raw.githubusercontent.com/Turgon37/DynUpdate/master/dynupdate.py || exit 1
chmod +x ipcheckadvanced/resources/dynupdate.py
echo -e ' => Copy IpCheck configuration to \e[33m config_user.conf \e[0m'
cp -i config.conf config_user.conf || exit 1
read -p 'Enter the server of your dynhost : ' server
read -p 'Enter the hostname of your dynhost : ' hostname
read -p 'Enter the username that is allowed to perform update : ' username
read -p 'Enter the password associated the above username : ' password
echo "
[extension.digchecker]
server = 8.8.8.8
hostname = $hostname
[extension.command]
exec = dynupdate.py
args = -a {ip} --no-output -s $server -h $hostname -u $username -p $password
event = E_START, E_UPDATE
" >> config_user.conf
echo "Add this line to your crontab to execute this script at 5 minutes (recommanded) interval"
echo ''
echo "*/5 * * * * $(pwd)/ipcheck.py --no-output --config=$(pwd)/config_user.conf"
echo ''
echo "Don't forget to reduce the TTL of your DNS zone if you want your change to be applied fastly"
;;
esac