Table of contents
Combined revision comparison
...
Red Hat Enterprise LinuxFedoraUbuntuCentOS
...
To register vpnserver to Linux as a daemon process, create a startup script, as shown below, with the name /opt/vpnserver.shetc/init.d/vpnserver. (The following startup script is a description example, and you may have to rewrite part of the script for it to work properly on your system.)
...
You can use a text editor or the cat command to write the above script to /etc/opt/vpnserver.shinit.d/vpnserver as a text file. To use the cat command to create the script, press Ctrl + D after the line break in the final line, as shown below.
...
After creating the /etc/opt/vpnserver.shinit.d/vpnserver startup script, change the permissions for this script so that the script cannot be rewritten by a user without permissions.
[root@machine vpnserver]# chmod 755 /opt/vpnserver.sh |
Next, create a systemd config file, as shown below, with the name /etc/systemd/system/vpnserver.serviceetc/init.d. (The following startup script is a description example, and you may have to rewrite part of the script for it to work properly on your system.)
[Unit] Description = vpnserver daemon [Service] ExecStart = /opt/vpnserver.sh start ExecStop = /opt/vpnserver.sh stop ExecReload = /opt/vpnserver.sh restart Restart = always Type = forking [Install] WantedBy = multi-user.target/vpnserver |
Lastly, use the systemctlchkconfig command to allow the above startup script to start automatically in the background when the Linux kernel starts.
[root@machine vpnserver]# systemctl enable |
...
[root@machine vpnserver]# systemctl start vpnserver |
...
[root@machine vpnserver]# systemctl stop vpnserver |
...
Version from 16:25, 20 Jan 2024
...
Red Hat Enterprise LinuxFedoraCentOS
...
To register vpnserver to Linux as a daemon process, create a startup script, as shown below, with the name /etc/init.d/vpnserver. (The following startup script is a description example, and you may have to rewrite part of the script for it to work properly on your system.)
...
You can use a text editor or the cat command to write the above script to /etc/init.d/vpnserver as a text file. To use the cat command to create the script, press Ctrl + D after the line break in the final line, as shown below.
...
After creating the /etc/init.d/vpnserver startup script, change the permissions for this script so that the script cannot be rewritten by a user without permissions.
[root@machine vpnserver]# chmod 755 /etc/ |
Lastly, use the chkconfig command to allow the above startup script to start automatically in the background when the Linux kernel starts.
[root@machine vpnserver]# |
...
[root@machine vpnserver]# |
...
[root@machine vpnserver]# |
...
Version as of 15:08, 14 Feb 2024
...
- Ubuntu
...
To register vpnserver to Linux as a daemon process, create a startup script, as shown below, with the name /opt/vpnserver.sh. (The following startup script is a description example, and you may have to rewrite part of the script for it to work properly on your system.)
...
You can use a text editor or the cat command to write the above script to /opt/vpnserver.sh as a text file. To use the cat command to create the script, press Ctrl + D after the line break in the final line, as shown below.
...
After creating the /opt/vpnserver.sh startup script, change the permissions for this script so that the script cannot be rewritten by a user without permissions.
[root@machine vpnserver]# chmod 755 /opt/vpnserver.sh |
Next, create a systemd config file, as shown below, with the name /etc/systemd/system/vpnserver.service. (The following startup script is a description example, and you may have to rewrite part of the script for it to work properly on your system.)
[Unit] Description = vpnserver daemon [Service] ExecStart = /opt/vpnserver.sh start ExecStop = /opt/vpnserver.sh stop ExecReload = /opt/vpnserver.sh restart Restart = always Type = forking [Install] WantedBy = multi-user.target |
Lastly, use the systemctl command to allow the above startup script to start automatically in the background when the Linux kernel starts.
[root@machine vpnserver]# systemctl enable vpnserver |
...
[root@machine vpnserver]# systemctl start vpnserver |
...
[root@machine vpnserver]# systemctl stop vpnserver |
...