noip3 / noip-duc - script for boot
by inukaze from LinuxQuestions.org on (#6KGKY)
Hi there some days ago i download and install "noip3" client using the follow commands
Code:#Install noip client :
mkdir /tmp/noip
cd /tmp/noip
wget https://dmej8g5cpdyqd.cloudfront.net/downloads/noip-duc_3.0.0.tar.gz
tar xf noip-duc_3.0.0.tar.gz
cd noip-duc_3.0.0/binaries
deb2tgz noip-duc_3.0.0_amd64.deb
su -c "installpkg noip-duc_3.0.0_amd64.txz ; ldconfig" rootCode:#Removing noipclient :
su -c "removepkg noip-duc_3.0.0_amd64.txz ; ldconfig" root
Contraseia:
Removing package: noip-duc_3.0.0_amd64
Removing files:
--> Deleting /lib/systemd/system/noip-duc.service
--> Deleting /usr/bin/noip-duc
--> Deleting /usr/share/doc/noip-duc/README.md
--> Deleting /usr/share/doc/noip-duc/copyright
--> Deleting empty directory /usr/share/doc/noip-duc/Well if you notice just one file relevant, the binary executable client.
Configuring the things, like my account on "noip" website, password, ddns data.
On some moment i should use the follow command :
Code:iptables -I INPUT -s [DISIRED_IP] -p tcp -m tcp --dport [DESIRED_PORT] -j ACCEPT
iptables -I INPUT -s [DISIRED_IP] -p udp -m udp --dport [DESIRED_PORT] -j ACCEPT
echo 'on more clear example :'
iptables -I INPUT -s inukazenoip.redirectme.net -p tcp -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -s inukazenoip.redirectme.net -p udp -m udp --dport 22 -j ACCEPTWell the thing is i am thinking how i should write my script for start noip client during boot, by the moment i had just write the follow
Code:#!/usr/bin/env bash
# Author : Inukaze ( Venezuela )
# WebSite : http://https://goo.gl/ij6WqW
# E-Mail : bloginukaze@gmail.com
# License : GPL 2
function noip-duc()
{
noipduc=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b noip-duc | grep -i "noip-duc" | cut -d " " -f02 | sed 's/[/]noip-duc//')
noipduc=$(echo "$noipduc/noip-duc")
while getopts u:p: flag
do
case "${flag}" in
u) username=${OPTARG};;
p) password=${OPTARG};;
esac
done
echo "Username: $username";
echo "Password: $password";
}
start() {
if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
echo "Gateway not defined yet, please init the network services."
exit 0;
fi
echo "Starting no-ip client daemon: "
"$noipduc/noip-duc" --username "$username" --password "$password"
}
stop() {
echo "Stopping no-ip client daemon: ";
for i in `"$noipduc" 2>&1 | grep Process | awk '{print $2}' | tr -d ','`
do
killall -9 "$noipduc"
done
else
echo "no-ip client daemon is not running" && exit 0
fi
}
status() {
if "$noip-duc" 2>&1 | grep Process 1>/dev/null ; then
echo "no-ip client daemon is running"
else
echo "no-ip client daemon is not runnig"
fi
}
restart() {
stop
sleep 1
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esaci think saved like /etc/rc.d/rc.noip
But someone had a better idea for this.
Code:#Install noip client :
mkdir /tmp/noip
cd /tmp/noip
wget https://dmej8g5cpdyqd.cloudfront.net/downloads/noip-duc_3.0.0.tar.gz
tar xf noip-duc_3.0.0.tar.gz
cd noip-duc_3.0.0/binaries
deb2tgz noip-duc_3.0.0_amd64.deb
su -c "installpkg noip-duc_3.0.0_amd64.txz ; ldconfig" rootCode:#Removing noipclient :
su -c "removepkg noip-duc_3.0.0_amd64.txz ; ldconfig" root
Contraseia:
Removing package: noip-duc_3.0.0_amd64
Removing files:
--> Deleting /lib/systemd/system/noip-duc.service
--> Deleting /usr/bin/noip-duc
--> Deleting /usr/share/doc/noip-duc/README.md
--> Deleting /usr/share/doc/noip-duc/copyright
--> Deleting empty directory /usr/share/doc/noip-duc/Well if you notice just one file relevant, the binary executable client.
Configuring the things, like my account on "noip" website, password, ddns data.
On some moment i should use the follow command :
Code:iptables -I INPUT -s [DISIRED_IP] -p tcp -m tcp --dport [DESIRED_PORT] -j ACCEPT
iptables -I INPUT -s [DISIRED_IP] -p udp -m udp --dport [DESIRED_PORT] -j ACCEPT
echo 'on more clear example :'
iptables -I INPUT -s inukazenoip.redirectme.net -p tcp -m tcp --dport 22 -j ACCEPT
iptables -I INPUT -s inukazenoip.redirectme.net -p udp -m udp --dport 22 -j ACCEPTWell the thing is i am thinking how i should write my script for start noip client during boot, by the moment i had just write the follow
Code:#!/usr/bin/env bash
# Author : Inukaze ( Venezuela )
# WebSite : http://https://goo.gl/ij6WqW
# E-Mail : bloginukaze@gmail.com
# License : GPL 2
function noip-duc()
{
noipduc=$(whereis -B "/usr/sbin" "/usr/local/sbin" "/sbin" "/usr/bin" "/usr/local/bin" "/bin" -b noip-duc | grep -i "noip-duc" | cut -d " " -f02 | sed 's/[/]noip-duc//')
noipduc=$(echo "$noipduc/noip-duc")
while getopts u:p: flag
do
case "${flag}" in
u) username=${OPTARG};;
p) password=${OPTARG};;
esac
done
echo "Username: $username";
echo "Password: $password";
}
start() {
if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then
echo "Gateway not defined yet, please init the network services."
exit 0;
fi
echo "Starting no-ip client daemon: "
"$noipduc/noip-duc" --username "$username" --password "$password"
}
stop() {
echo "Stopping no-ip client daemon: ";
for i in `"$noipduc" 2>&1 | grep Process | awk '{print $2}' | tr -d ','`
do
killall -9 "$noipduc"
done
else
echo "no-ip client daemon is not running" && exit 0
fi
}
status() {
if "$noip-duc" 2>&1 | grep Process 1>/dev/null ; then
echo "no-ip client daemon is running"
else
echo "no-ip client daemon is not runnig"
fi
}
restart() {
stop
sleep 1
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esaci think saved like /etc/rc.d/rc.noip
But someone had a better idea for this.