_2018_:: october:: _15_
pub const _15_: ()
I have one note ahead: I'm an amateur programmer. So my experiences should only be used as references.
Quoting from its website:
systemdis a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.
systemdprovides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points, and implements an elaborate transactional dependency-based service control logic.
systemdsupports SysV and LSB init scripts and works as a replacement for sysvinit. Other parts include a logging daemon, utilities to control basic system configuration like the hostname, date, locale, maintain a list of logged-in users and running containers and virtual machines, system accounts, runtime directories and settings, and daemons to manage simple network configuration, network time synchronization, log forwarding, and name resolution.
From my view, it's basically a process manager.
Normally, a service file is put in
.service extension. For example:
[Unit] Description=API-1 [Service] ExecStart=/home/api1/bin/api1 WorkingDirectory=/home/api1/bin/ LimitCPU=infinity LimitCORE=infinity LimitNOFILE=infinity MemoryLimit=infinity [Install] WantedBy=multi-user.target
Note that some default settings are very limited. For example I called
libc::RLIMIT_NOFILE under root user, and got
1_048_576. But then calling that when running as a service, I got
4095, I don't remember correctly). That's why I added some
limit flags to the sample.
sudo systemctl enable --now file-name.service
To disable, replace
systemctl status file-name.service
Parsable by machine:
systemctl show file-name.service
I guess you might want to try with your test projects first.