systemd services

  • https://www.freedesktop.org/software/systemd/man/systemd.service.html
  • http://manpages.ubuntu.com/manpages/cosmic/man5/systemd.service.5.html
  • https://unix.stackexchange.com/questions/125714/forking-in-a-systemd-script

Services anzeigen

# Alle anzeigen
systemctl
 
# Nur Services
systemctl --type=service
 
# Nur active services
systemctl --type=service --state=active
 
# Nur running services
systemctl --type=service --state=running
 
# Status anzeigen
systemctl is-enabled apache2.service
systemctl cat apache2.service
systemctl status apache2

Autostart disable

sudo systemctl disable apache2

Autostart enable

sudo systemctl enable apache2

Loggröße beschränken

sudo journalctl --disk-usage
sudo journalctl --rotate --vacuum-size=500M

docker-websites.service

  • https://www.robertpeteuil.com/posts/docker-solution-as-a-service-3005

Process when making changes to the service definition file:

# Stop the service: 
sudo systemctl stop docker-websites
 
# Disable the service: 
sudo systemctl disable docker-websites
 
# Copy the new service file: 
sudo cp docker-websites.service /lib/systemd/system/
 
# Reload the Daemon: 
sudo systemctl daemon-reload
 
# Enable Updated Service: 
sudo systemctl enable docker-websites
 
# Start the Updated Service: 
sudo systemctl start docker-websites
 
#
# Fehlersuche
#
 
# Status and log of service: 
sudo systemctl status docker-websites
 
# Full Logs for service: 
journalctl -u docker-websites
 
# Full Logs for service with word-wrapping: 
SYSTEMD_LESS=FRXMK journalctl -u docker-websites