Files
POConsole-Autoconfig/configure_ddclient.sh
Patrick McDonagh ab9da50b90 Daemonize ddclient
2016-02-24 15:13:39 -06:00

50 lines
1.5 KiB
Bash

#!/bin/bash
clear
echo "Script to configure ddclient to work with *.poconsole.net"
echo "Written by Patrick McDonagh"
sleep 1
if [[ $EUID -ne 0 ]]; then
echo "HEY! This script must be run as root!" 1>&2
exit 1
fi
echo "Are you sure you want to run the script? [y/n]"
read run_start
if [ "$run_start" = "y" ]; then
echo "Making sure ddclient is installed..."
echo "While that's happening check http://domains.google.com for the username and password"
apt-get install ddclient
clear
echo "Ok, on to the good stuff... Let's get configured!"
echo "Enter the generated username:"
read username
echo "Enter the generated password:"
read password
echo "Enter the well name:"
read well_name
echo "Enter the company identifier:"
read company_ident
echo "daemon=3600" > ddclient.conf
echo "protocol=dyndns2" >> ddclient.conf
echo "use=web" >> ddclient.conf
echo "server=domains.google.com" >> ddclient.conf
echo "ssl=yes" >> ddclient.conf
echo "login=$username" >> ddclient.conf
echo "password=$password" >> ddclient.conf
echo "$well_name.$company_ident.poconsole.net" >> ddclient.conf
echo "Good work, class! Let's apply the settings!"
mv ddclient.conf /etc/
sed -i 's/run_daemon="false"/run_daemon="true"/g' /etc/default/ddclient
sed -i 's/daemon_interval="300"/daemon_interval="3600"/g' /etc/default/ddclient
/etc/init.d/ddclient start
/etc/init.d/ddclient status > ddclient.log
cat ddclient.log
else
echo "Your loss... I was going to do some cool stuff..."
fi