Skip to content

Services

GradedJestRisk edited this page Jul 26, 2021 · 3 revisions

Table of Contents

Services

Status

Get all services: sudo systemctl status

Search service: systemctl status | grep <SERVICE_NAME> , will give you .service

Eg. systemctl status | grep clam

             ├─clamav-daemon.service 
             │ └─1646 /usr/sbin/clamd --foreground=true
             ├─clamav-freshclam.service 
             │ └─2301 /usr/bin/freshclam -d --foreground=true

You have 2 services:

  • clamav-clamd
  • clamav-freshclam
Get a service'status: systemctl status <SERVICE_NAME>

Get log:

  • get service log: journalctl -u <SERVICE_NAME> -b , eg. journalctl -u snap.docker.dockerd.service -b
  • get list on fs: /etc/systemd/system/multi-user.target.wants/<SERVICE-NAME>, eg. snap.docker.dockerd.service

Activate/Deactivate

Deactivate:

  • in this session: sudo systemctl stop <SERVICE_NAME>, eg sudo systemctl stop postgresql@12-main
  • on next startup: sudo systemctl disable <SERVICE_NAME>
  • forever:
Warning: Postgresql will recreate a service at startup based on start.conf file, so you need to alter this one instead of using systemctl see here

Activate:

  • in this session: sudo systemctl start <SERVICE_NAME>
  • on next startup: sudo systemctl enable <SERVICE-NAME>
More on service restart

Create your own service

create a service

Clone this wiki locally