-
Notifications
You must be signed in to change notification settings - Fork 7.7k
How to start XX Net as a background service under Linux
#Start XX-Net as a background service
If you want to start XX-Net as a service, XX-net has actually provided a sysv startup script: [xx_net.sh](https://github.com/XX-net/XX-Net/search?q=xx_net. sh&type=Code&utf8=%E2%9C%93)
Suppose your xx_net.sh is in /home/yourName/XX-Net/xx_net.sh, Then execute in the /etc/init.d directory
'sudo ln -s /home/yourName/XX-Net/xx_net.sh xx_net'
*Tips: If you find that using the hyperlink above, the xx_net service cannot start when the system starts, but you can start the service with sudo service xx_net start, and when you run dmesg|grep xx_net, you will find /etc/init .d/xx_net no such file or directory error, then you may have encountered a systemd bug, the solution is to copy /home/yourName/XX-Net/xx_net.sh to /etc/init.d/xx_net, and then modify / $PACKAGE_PATH='/home/yourName/XX-Net/code/default' in etc/init.d/xx_net
If the system uses systemD for service management, execute the following command to enable the xx_net service:
sudo systemctl enable xx_net
If you are a debian system, use the following command to enable the xx_net service:
sudo update-rc.d enable xx_net
Start xx-net:
sudo service xx_net start
Stop xx-net:
sudo service xx_net stop
Restart xx-net:
sudo service xx_net restart
View XX-net status:
sudo service xx_net status
Or it is more reliable to use the following command:
sudo netstat -tlanp grep 8087
The log is saved in the /var/log/messages file, and can be viewed with the tail command:
tail -f /var/log/messages|grep xx_net
Currently, major distributions use Systemd init to manage system services. Fedora users can add FZUG source, install xx-net And use systemd management.
Start xx-net:
$ systemctl --user start xx-net
View status:
$ systemctl --user status xx-net
Stop xx-net:
$ systemctl --user stop xx-net
Use systemctl user mode management, without running with root privileges, improve security.