Categories
Linux

output systemd daemon to console

Per default setting all services log only to journal and not to console. You can check the settings of a service with:

sudo systemctl show MyService.service | grep -Fi Standard

And you should get something like.

StandardInput=null
StandardInputData=
StandardOutput=journal
StandardError=inherit

If you want to change it, you have to set StandardOutput to journal+console.

The full options are documented in the man pages. You can look into man page of systemd.directives:

man systemd.directives

Search for StandardOutput and you will find a reference to the man page of systemd.exec. There you will find every option of this directive.

To change it you should call:

sudo systemctl edit MyService.service

and then add or change the line of StandardOutput to

[Service]
StandardOutput=journal+console

After all you should reload systemd configuration:

sudo systemctl daemon-reload
Categories
Linux

inspect a systemd service

To inspect a systemd service, you need some handy commands.

Examine service names

First you have to get the correct service name you want to inspect.

systemctl list-units --type=service

You can use grep to filter the list.

Gather information of service

You can show the current status of a service with:

systemctl status servicename

Then you can display all options that describe the service:

systemctl show servicename

And you can show all files which belongs to the service description:

systemctl cat servicename