Create service so DNS2Go starts when Ubuntu starts
Article Details
URL:
https://support.deerfield.net/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=750
Article ID:
750
Created On:
Aug 23, 2010 12:33 PM
Answer
This article applies to DNS2Go Linux Debian 2.2 download and Ubuntu Desktop 10.04
1. Open terminal and type the following,
cd /etc/init.d/
2. Next open a new file using nano, or your choice of text editors, to create a script that will start DNS2Go, type the following,
sudo nano dns2go
3. Paste the follow text into nano
---------- Start COPY after this line ---------
#!/bin/sh
#
# Start/Stop DNS2Go service.
# DNS2Go Support
DAEMON=/usr/local/bin/dns2go
RUN_MODE="daemons"
. /lib/lsb/init-functions
# See if DNS2Go exist
test -x $DAEMON || exit 0
case "$1" in
start)
log_begin_msg "Starting DNS2Go..."
start-stop-daemon --start --background --oknodo --exec $DAEMON -- run
log_end_msg $?
;;
stop)
log_begin_msg "Stopping DNS2Go..."
start-stop-daemon --stop --oknodo --exec $DAEMON
log_end_msg $?
;;
restart|force-reload)
log_begin_msg "Restarting DNS2Go..."
start-stop-daemon --stop --oknodo --exec $DAEMON
sleep 2
start-stop-daemon --start --background --oknodo --exec $DAEMON -- run
log_end_msg $?
;;
*)
log_success_msg "Usage: /etc/init.d/dns2go {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
---------- End COPY before this line ---------
4. Save by pressing ctrl X, and save to the same file name 'dns2go'
5. We need to set rights by typing,
sudo chmod 755 /etc/init.d/dns2go
6. Next we need to create a symbolic link in /etc/rcS.d/ that links to the DNS2Go service script so it starts when Ubuntu starts. The S72 before the name is the priority of when the dns2go service will start, make sure it's after networking services, 72 likely has the least priority. Type the following,
sudo ln -s /etc/init.d/dns2go /etc/rcS.d/S72dns2go
7. Now restart Ubuntu and DNS2Go should start as a service.