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 service
- systemctl disable service
- systemctl start serviceruns the service
- systemctl restart service
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.target- sudo systemctl enable myservice.service
- sudo systemctl start myservice.service
Creating Userland Services
- apt install dbus-user-session dbus
- reboot
- mkdir -p ~/.config/systemd/user
- vim ~/.config/systemd/user/myservice.service
- Write the service file here
- systemctl