How can I send a message to the systemd journal from the command line?

systemd-cat is the equivalent to logger: echo ‘hello’ | systemd-cat In another terminal, running journalctl -f: Feb 07 13:38:33 localhost.localdomain cat[15162]: hello Priorities are specified just by part of the string: echo ‘hello’ | systemd-cat -p info echo ‘hello’ | systemd-cat -p warning echo ‘hello’ | systemd-cat -p emerg Warnings are bold, emergencies are bold … Read more

Is there a way to see the execution tree of systemd?

systemd-analyze is your friend. For example systemd-analyze critical-chain outputs blocking tree of daemons. Mine for example: graphical.target @20.211s └─multi-user.target @20.211s └─nginx.service @19.348s +862ms └─network.target @19.347s └─NetworkManager.service @10.315s +9.031s └─basic.target @10.312s └─timers.target @10.311s └─systemd-tmpfiles-clean.timer @10.311s └─sysinit.target @10.295s └─systemd-update-utmp.service @10.167s +127ms └─systemd-tmpfiles-setup.service @10.124s +41ms └─local-fs.target @10.097s └─home-entd-Downloads.mount @10.093s +2ms └─home.mount @9.326s +672ms └─[email protected] @8.472s +696ms └─dev-sda6.device @8.471s … Read more

Does getting disconnected from an SSH session kill your programs?

Edit for 2016: This Q&A predates the systemd v230 debacle. As of systemd v230, the new default is to kill all children of a terminating login session, regardless of what historically valid precautions were taken to prevent this. The behavior can be changed by setting KillUserProcesses=no in /etc/systemd/logind.conf, or circumvented using the systemd-specific mechanisms for … Read more

Find the location of a systemd unit file service

For units that are defined in actual, static files, this can be seen in systemctl status: $ systemctl status halt-local.service ● halt-local.service – /usr/sbin/halt.local Compatibility Loaded: loaded (/lib/systemd/system/halt-local.service; static) Active: inactive (dead) But there are units that are not defined by files, e.g. with systemd-cron installed. These have no useful location listed with status: $ … Read more

Do systemd unit files have to be reloaded when modified?

After you make changes to your unit file, you should run systemctl daemon-reload, as outlined here. daemon-reload Reload systemd manager configuration. This will rerun all generators (see systemd.generator(7)), reload all unit files, and recreate the entire dependency tree. While the daemon is being reloaded, all sockets systemd listens on behalf of user configuration will stay … Read more

How to set environment variable in systemd service?

Times change and so do best practices. The current best way to do this is to run systemctl edit myservice, which will create an override file for you or let you edit an existing one. In normal installations this will create a directory /etc/systemd/system/myservice.service.d, and inside that directory create a file whose name ends in … Read more

Elasticsearch: Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

Vivek’s answer is correct, however, the setting will only last for the duration of the session. If the host reboots, the setting will be reset to the original value. If you want to set this permanently, you need to edit /etc/sysctl.conf and set vm.max_map_count to 262144. When the host reboots, you can verify that the setting is still correct … Read more