systemd
Check if systemd is installed
This will show you the actual file the symbolic link /sbin/init
points to.
You can infer your system daemon from the output. For example, the output would look like this if systemd is used:
Steps
Create service
Enter the systemd service configuration directory.
Create a new file zbproxy.service
.
[Unit]
Description=ZBProxy Service
Documentation=https://github.com/layou233/ZBProxy
After=network-online.target #(1)!
[Service]
Type=simple
WorkingDirectory=/usr/local/etc/zbproxy #(2)!
ExecStart=/usr/local/bin/zbproxy #(3)!
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGTERM
Restart=on-failure
[Install]
WantedBy=multi-user.target
- If you got any error with
network-online.target
, try to replace it withnss-lookup.target
. See https://github.com/layou233/ZBProxy/pull/100 . - The directory where the ZBProxy.json configuration is saved.
- The path of ZBProxy executable file.
You can find the same example at the root directory of the repository.
Use service
After finishing service configuration, reload the systemd daemon to enable it.
This should only be performed after editing the configuration.
Then start the service.
Frequently used commands
Start the service:
Check service status:
Restart service (stop and restart, which will terminate all existing connections):
Reload ZBProxy configuration (keep all existing connections):
This is also automcatically performed when configuration file change is detected by file watcher.
Stop service:
Check log in real time: