Often I find the instructions of the different suppliers too general and it doesn’t work the way you would like it to. For example, I use https://www.noip.com for my dynamic DNS updates and have found that the instructions for installing the noip2 dynamic update client are unclear and not suitable for use on the latest Ubuntu servers. Ideally, the noip2 dynamic DNS update client should constantly search for changes in the IP address in the background and automatically update the DNS if no IP address is available. But there are not enough instructions, because if you restart the server, it won’t work because it won’t start at startup. This post tries to solve this problem by installing the packages needed to execute the make command, installing the binary Noip2, restoring the permissions of the files if they are missing, creating an init.d script for the service command, creating a systemd file so we can handle it with systemd, and finally enabling it with systemctl. I know, I know, I overreacted, but it didn’t hurt, and now you have different ways to control it. If you are familiar with this system, you can skip the parts and go to the appropriate parts to use init.d or systemd. Let’s get started:
.Setting the conditions
SSH to your Linux server and sudo itself for root access and requirements. You can probably ignore it if it’s already installed. As soon as the installation of the binary is finished, we can remove it. So there was no damage.
make good fit gcc -y
List of amendments
[email protected]:~# cd /usr/local/src/
[email protected]:/usr/local/src#
Download noip2 dynamic customer update:
[email protected]:/usr/local/src# wget http://www.noip.com/client/linux/noip-duc-linux.tar.gz
–2020-11-18 08:25:20- http://www.noip.com/client/linux/noip-duc-linux.tar.gz
Resolution www.noip.com (www.noip.com)…… 8.23.224.107
Connection to www.noip.com (www.noip.com)|8.23.224.107|:80 .
HTTP request sent, response pending… 200 OK
length : 134188 (131K) [application/x-gzip]
Savings to: noip-duc-linux.tar.gz
noip-duc-linux.tar 100% [===================>] 131.04K 113KB/s in 1.2 sec.
2020-11-18 08:25:22 (113 KB/s) – noip-duc-linux.tar.gz rescued [134188/134188].
Unpacking:
[email protected]:/usr/local/src# tar xf noip-duc-linux.tar.gz
Package of amendments:
[email protected]:/usr/local/src# cd noip-2.1.9-1/
[email protected]:/usr/local/src/noip-2.1.9-1#.
Set with marking:
Install with the make command, which GCC uses to create the binaries, then you will be prompted to login with your No-IP account username and password.
[email protected]:/usr/local/src/noip-2.1.9-1# install
gcc -wall -g -Dlinux -DPREFIX=/usr/local noip2.c -o noip2
noip2.c : In the dynamic_update function:
noip2.c:1595:6 : warning : the ‘i’ variable set but not used [-Wunused-but-set-variable]
int i, x, is_group, retval, response ;
^
noip2.c : Domain Function:
noip2.c:1826:13 : Disclaimer : Variable x is set but not used [-Wunused-but-set-variable]
int x ;
^
noip2.c In the host function:
noip2.c:1838:20 : warning : Y variable defined but not used [-Wunused-but-set-variable]
int x, y, z ;
^
if [ ! -d /usr/local/bin ] ; mkdir -p /usr/local/bin;fi
if [ ! -d /usr/local/etc ]; then mkdir -p /usr/local/etc;fi
cp noip2 /usr/local/bin/noip2
/usr/local/bin/noip2 -C -c /tmp/no-ip2.conf.
Automatic configuration for the no-ip.com Linux client.
Enter your login/e-mail for no-ip.com [email protected]
Enter your password for ’[email protected]’ ******.
Only one host [noipdomain.ddns.net] is registered for this account.
It will be used.
Enter the update interval: 30]
If the update is successful, you want to perform something [N] (y/n) N.
A new configuration file /tmp/no-ip2.conf has been created.
Move the configuration file to the correct location:
[email protected]:/usr/local/src/noip-2.1.9-1# mv /tmp/no-ip2.conf /usr/local/etc/no-ip2.conf
Work as a service or init.d or systemd.
Now just let it run and it’ll work as usual. But the problem is that when you restart the server, it doesn’t start automatically and noip2 doesn’t work as a service (i.e. via systemctl). This means that you will get errors if you try the following commands:
[email protected]:/usr/local/etc# systemctl status noip2
noip2.service found
[email protected]:/usr/local/etc# systemctl could noip2.service
could not find the device The device noip2.service file does not exist.
Service/input
So let’s create a service for him so we can check him out with a service team. Repair the file permissions and then run the init.d script.
[email protected]:/usr/local/src/noip-2.1.9-1# chmod 600 /usr/local/etc/no-ip2.conf
[email protected]:/usr/local/src/noip-2.1.9-1# chown root:root /usr/local/etc/no-ip2.conf
r[email protected]:/usr/local/src/noip-2.1.9-1# vi /etc/init.d/no-ip2.sh
Insert into file and save.
########################################################! /bin/sh# . /etc/rc.d/init.d/functions # uncomment/modify for your killproccase $1 instart)echo Start noip2./usr/local/bin/noip2;;;;stop)echo -n Noip2.killproc -TERM /usr/local/bin/noip2;;;;*)disable echo Use: $0 {start|stop} exit 1esac output 0#######################################################.
Make them executable and update them.
[email protected]:/usr/local/src/noip-2.1.9-1# sudo chmod +x /etc/init.d/noip2.sh
[email protected]:/usr/local/src/noip-2.1.9-1# sudo update-rc.d noip2.sh default
Ideally, you can start the service immediately with a service team.
ro[email protected]:/usr/local/src/noip-2.1.9-1# sudo service noip2 status
System or Systemctl channel
However, if you are using Ubuntu 15.04 or later, the standard method for maintaining background processes (and much more) is system-controlled. I suggest you switch from your init.d script to System Unit:
Create a noip2 service for system
Create the /etc/systemd/system/noip2.service file with the following content (and insert your init.d scripts)
[email protected]:/usr/local/src/noip-2.1.9-1# vi /etc/systemd/noip2.service
Insert and store the following.
Converter]
Description=continuous service2
Service]
Type=operational
ExecStart=/usr/local/bin/noip2
Restart=reversible
WantedBy=default.target
Small return
Because noip2 works as a daemon, i.e. when you execute it, it creates another process that runs in the background (the so-called fork) and the process in the foreground comes back (out) immediately. For this reason, the init.d script and system unit will not work: You started Noip2 to see him come out right away. As a result, systemd tried to restart over and over again with no result. (By default, systemd restarts the process up to 5 times within about 10 seconds before it is aborted and the process is left in a bad state.) To tell Systemd that this is a forking device, we have added the Type=forking line to the [Service] section, as I just did in the excerpt above. This tells the system to expect an immediate return of the main process and instead observe the process generated by (fork)noip2.
Reboot the daemon to inform the system about Noip2
Then type the following command to notify systemd of the new module (systemd stores the module files in its cache, and this command forces systemd to revise its cache)
[email protected]:/usr/local/src/noip-2.1.9-1# sudo systemctl daemon reload
Using the systemctl to control the Noip2
You can now try to start and stop the device and see its status:
root@ubuntu:/usr/local/src/noip-2.1.9-1# sudo systemctl status noip2
roo[email protected]:/usr/local/src/noip-2.1.9-1# sudo systemctl start noip2
root@ubuntu:/usr/local/src/noip-2.1.9-1# sudo systemctl status noip2
ro[email protected]:/usr/local/src/noip-2.1.9-1# sudo systemctl stop noip2
root@ubuntu:/usr/local/src/noip-2.1.9-1# sudo systemctl status noip2
Enabling during billing:
In order to start the device at startup, you must turn it on:
root@ubuntu:/usr/local/src/noip-2.1.9-1# sudo systemctl enable noip2
Disconnection during charging:
To turn off the Autorun at startup, you must turn off the device:
[email protected]:/usr/local/src/noip-2.1.9-1# sudo systemctl sudo systemctl switch off sudo systemctl noip2
In most cases, five commands are sufficient to control the behaviour of the aircraft:
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl start $unit # start a unit NU
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl stop $unit # stop a unit NU
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl status $unit # displays status
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl enable $unit # start a unit at startup (but does not stop NU)
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl turn off $unit # stop auto-start (but does not stop NU)
You can also activate automatic start and start the device without delay or deactivate automatic start and stop it immediately:
[email protected]:/usr/local/src/noip-2.1.9-1# turn on systemctl –now turn on $unit # and start in one go
[email protected]:/usr/local/src/noip-2.1.9-1# turn off systemctl –now turn off $unit # and stop in one go
Status check:
Let’s check the status:
[email protected]:/usr/local/src/noip-2.1.9-1# systemctl status noip2
● noip2.service
Downloaded: downloaded (/etc/system/noip2.service; enabled; manufacturer setting: enabled)
Active: active (in progress) from Wednesday 2020-11-18 08:43:35 UTC; 1h 56min reverse
Main PIN: 6798 (noip2)
Tasks: 1 (restriction: 4915)
CGroup: /system.slice/noip2.service
└─6798 /usr/local/bin/noip2
18. November, 08:43:35 ubuntu systemd [1] : noip2.service starts at…
18. November 08:43:35 ubuntu noip2 [6797] : Dead process recovery 6250 ubuntu slot
November 18 08:43:35 ubuntu noip2 [6798] : v2.1.9 daemon started with NAT
November 18 08:43:35 ubuntu systemd [1] : Noip2.service has been launched.
18 Nov 08:43:38 ubuntu noip2 [6798]: noipdomain.ddns.net is already installed at 100.100.101.102
18 Nov 08:43:48 ubuntu systemd [1]: /etc/systemd/system/noip2.service:1 : Command outside the section. Ignore him.
18. November 10:30:52 ubuntu systemd[1]: /etc/systemd/system/noip2.service:1 : Command outside the section. Ignore him.
[email protected]:/usr/local/src/noip-2.1.9-1#
A much better result than deploying a service team.
Outcome of Protocol
This also results in a cleaner result:
[email protected]:~# journalctl -xe
— noip2.service unit started.
18. November 08:43:35 ubuntu systemd [1] : Noip2.service has been launched.
— object : The noip2.service device has completed booting
— Defined by: systemd
— Support: http://www.ubuntu.com/support
—
— The noip2.service device has completed booting.
—- Initial result – RESULT 18 November 08:43:38 ubuntu noip2 [6798]: noipdomain.ddns.net is already set to 100,100,101,102.
Clear the mess
Now everything is ready, and if you don’t need make-up or gcc anymore, you can take it off and clean it.
Removegcc and turn
[email protected]:/usr/local/etc# apt remove make gcc -y
Read package lists… Ready
Build Dependency Tree
Ready
The following packages were installed automatically and are no longer needed:
gcc-7 libasan4 libatomic1 libc-dev-bin libc6-dev libc1-0 libcilkrts5
libgcc-7-dev libitm1 liblsan0 libmpx2 libquadmath0 libtsan0 libubsan0
linux-libc-dev manpages-dev
Use apt autoremove to remove them.
The following packages are removed:
gcc do
<—-SNIP—->
trigger treatment for man-db (2.8.3-2ubuntu0.1) …
Cleaning of unused packaging
Go hunt for the rest of the bags:
[email protected]:/usr/local/etc# apt autoremove
Read package lists… Ready
Build Dependency Tree
Read status information Done at
The following packages are being removed:
gcc-7 libasan4 libatomic1 libc-dev-bin libc6-dev libcc1-0 libcilkrts5
libgcc-7-dev libitm1 liblsan0 libmpx2 libquadmath0 libtsan0 libubsan0
linux-libc-dev manpages-dev
0 updated, 0 reinstalled, 16 removed and 0 not updated.
This process frees up 75.1 MB of hard disk space.
Do you want to continue? Y/n] y
(Read the database … 111762 files and folders currently installed)
<—-SNIP—->.
Treatment initiation for libc-bin (2.27-3ubuntu1.3) …
[email protected]:/usr/local/etc# …
Result of the process tree
There’s… Everything is clean and flawless2 and now works as a service.
[email protected]: ~# pstree
systemd ─├─VGAuthService
├─Demon accounts ──── 2* [─ accounts}]
├─atd
{{{{─noip2
<—-SNIP—->
[email protected]: ~#.
Pretty happy. Yeah, I understand you don’t need a service team anymore, but sometimes I accidentally print it and then at least I have it. Enjoy it.
Related Tags:
6800 xt release date,6800 xt vs 3080,6800 xt review,asus 6800 xt,sapphire 6800 xt,rx 6800 vs 3070,guru3d msi afterburner,guru 3d pc forum,guru downloads,techup power,techpowerup c om,nvidia rumors,rx 5500,rx 5500 xt,amd 5700 xt,radeon 5700 xt