Once registered and installed the client on your Raspberry Pi you can create a startup script to automatically restart the client after a RPI reboot
- Create a script in /etc/init.d/noip
# sudo vi /etc/init.d/noip
copy and paste the following:
#! /bin/sh
# /etc/init.d/noip
### BEGIN INIT INFO
# Provides: noip
# Required-Start: networking
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start noip at boot time
# Description: Start noip at boot time
### END INIT INFO
# . /etc/rc.d/init.d/functions # uncomment/modify for your killproc
DAEMON=/usr/local/bin/noip2
NAME=noip2
NOIP=`ps -ef|grep -q [n]oip2`
STATUS=$?
test -x $DAEMON || exit 0
case "$1" in
start)
echo -n "Starting dynamic address update: "
start-stop-daemon --start --exec $DAEMON
echo "noip2."
;;
stop)
echo -n "Shutting down dynamic address update:"
start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
echo "noip2."
;;
restart)
echo -n "Restarting dynamic address update: "
start-stop-daemon --stop --oknodo --retry 30 --exec $DAEMON
start-stop-daemon --start --exec $DAEMON
echo "noip2."
;;
status)
if [ ${STATUS} -eq "0" ];then
echo "noip2 running..."
else
echo "noip2 Not running..."
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
- Set exec permissions
# sudo chmod 755 /etc/init.d/noip
- Add script to Startup/Shutdown
No comments:
Post a Comment