Linux’s init system
Install
Sudo pacman -S systemd
Systemctl
Software to configure the system’s OS Service that run at startup.
systemctl enable serviceto enable autostart of the servicesystemctl disable servicesystemctl start serviceruns the servicesystemctl restart servicesystemctl daemon-reloadto reload configuration files
Creating Services
vim /etc/systemd/system/myservice.service
[Unit]
Description=Serve site using npx serve
After=network.target
[Service]
Type=simple
WorkingDirectory=/path-to-work-with
ExecStart=/command-to-run
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.targetsudo systemctl enable myservice.servicesudo systemctl start myservice.service
Creating Userland Services
apt install dbus-user-session dbusrebootmkdir -p ~/.config/systemd/user- vim
~/.config/systemd/user/myservice.service - Write the service file here
systemctl