Running Liwan as a Service
Liwan can be run as a service on most operating systems. This allows you to start Liwan automatically when your server boots and manage it using the system’s service manager. Systemd is the most common and is used by most modern Linux distributions. Another popular init system is OpenRC, which is used by Gentoo and Alpine Linux.
-
Creating the service
To run Liwan as a service usingsystemd
, create a new service file in/etc/systemd/system/liwan.service
with the following content:Replace
yourusername
with your username and adjust the paths to match your setup. To generate a configuration file, you can runliwan generate-config -o ~/.config/liwan/liwan.config.toml
. -
Starting the service
After creating the service file, reload the systemd daemon and start the service: -
Checking the status
You can now check the status of the service usingsystemctl status liwan
and view the logs usingjournalctl -u liwan
. If this is the first time you are running Liwan, you can find a link to set up your account in the logs.
-
Creating the service
To run Liwan as a service usingOpenRC
, create a new service script in/etc/init.d/liwan
with the following content:Replace yourusername with your username and adjust the paths to match your setup. Make sure the script is executable:
To generate an example configuration file, you can run
liwan generate-config -o ~/.config/liwan/liwan.config.toml
. -
Starting the service
Starting the service After creating the service script, add the service to the default runlevel and start it: -
Checking the status
You can now check the status of the service usingrc-service liwan status
and view the logs usingtail -f /var/log/liwan/liwan.log
. If this is the first time you are running Liwan, you can find a link to set up your account in the logs.