Questions tagged [systemd]

systemd is a modern replacement for the traditional Linux init. Its main features include the ability to express dependencies between services and aggressive parallelization of service startup.

systemd, created by Lennart Poettering and Kay Sievers, is a modern replacement for the traditional Linux init, whether System-V or BSD-style initscripts. Its main features include the ability to express dependencies between services and aggressive parallelization of service startup.

1471 questions
13
votes
3 answers

How get systemd status in json format?

I want to get service status details (Loaded, enabled, active, running, since, Main PID) in machine readable form and I know that systemd tools have --output=json option, but if I do: systemctl status servicename --output=json --plain I see…
Stanislav Ivanov
  • 383
  • 1
  • 3
  • 10
13
votes
1 answer

Wait for service to gracefully exit before machine shutdown/reboot

How do you write a systemd service that gracefully shuts down upon machine shutdown or reboot? In particular, it should delay machine shutdown until it exits gracefully. I have a service that takes 10 seconds to shut down:…
yonran
  • 797
  • 2
  • 11
  • 22
13
votes
3 answers

SaltStack: Execute `systemctl --system daemon-reload` if service file was changed

We deploy and change system service files via SaltStack. For example, if file /etc/systemd/system/superfoo.service gets changed, then systemd emits this warning: Warning: Unit file of superfoo.service changed on disk, 'systemctl --system…
guettli
  • 3,591
  • 17
  • 72
  • 123
13
votes
1 answer

How to use variables in a systemd service file?

I'm creating a service file for a daemon, and I would like to use variables (in init scripts I used environment variables) to define some parameters for the executed scripts. For example, I would like to use 2 parameters $PARAM1…
user886869
  • 245
  • 1
  • 2
  • 10
13
votes
5 answers

Systemd - start service only after DNS is available

I've got a couple services, most notably nginx and ntpd, that depend on having working DNS resolution to start properly. Right now neither of these services start correctly at boot time, but do start fine when manually intervened on once the machine…
Brando__
  • 412
  • 1
  • 3
  • 11
13
votes
2 answers

How to configure systemd to kill and restart a daemon on reload?

I have an old-school daemon that I want to control using systemd. When its configuration file changes, it needs to be killed and restarted. In other words, after editing the config file, systemctl reload MYSERVICE should kill the process and…
TomOnTime
  • 7,945
  • 6
  • 32
  • 52
13
votes
1 answer

Systemctl: find out which commands are applicable for a service

How do I find out which commands are applicable for a service with systemctl? # systemctl reload nagios.service failed to reload nagios.service: Job type reload is not applicable for unit nagios.service. With init.d you could run the script without…
Lerkes
  • 191
  • 1
  • 1
  • 7
13
votes
2 answers

How to display syslog priority level in systemd's journalctl

journalctl allows me to filter on priority (-p) and color-codes the priority in the output. But is there any way to get it to output the priority directly, as text?
Avi Kivity
  • 233
  • 2
  • 6
13
votes
1 answer

Failed to issue method call: Unit ... failed to load: No such file or directory

I have a systemd definition file installed, but systemd fails to use it. What might the trouble be, or how can I debug it? ettin:~# ls -l /etc/systemd/system/efl_test_daemon.service -rwxr-xr-x 1 root root 145 Aug 18 13:11…
Neil H Watson
  • 448
  • 1
  • 5
  • 18
13
votes
3 answers

Finding how a Linux system was booted

I have a remote server, running Linux 5.19.0-41-generic x86_64, I am trying to find out how it was booted. Apparently, it does not use systemd : PID 1 process is bash. ps -p 1 -o comm= bash Apparently, there is no GRUB, at least there is none in…
0x11111
  • 131
  • 3
12
votes
2 answers

What could cause a systemd service stop to end with job being canceled?

Occasionally when stopping a systemd service with systemctl stop test-server it will fail mentioning that the job was canceled: Unable to stop service test-server: Job for test-server.service canceled. What could cause stopping of the service to be…
Markus Miller
  • 1,974
  • 3
  • 15
  • 15
12
votes
1 answer

systemd script for starting my app server - Unknown lvalue 'StartLimitIntervalSec' in section 'Unit'

I have a upstart configuration file as shown below which works fine in Ubuntu 14: #/etc/init/data_server.conf #sudo start data_server #sudo stop data_server #sudo status data_server start on runlevel [2345] stop on runlevel [016] chdir…
user1950349
  • 223
  • 1
  • 3
  • 10
12
votes
7 answers

How to enable systemd on Amazon Linux AMI

I started using Amazon Linux AMIs. It seems to have the /etc/systemd/system/ folder, but I am not able to use systemctl to start stop a service I added to the /etc/systemd/system/ folder. $ systemctl bash: systemctl: command not found
Saqib Ali
  • 428
  • 2
  • 7
  • 21
12
votes
3 answers

How can I predict systemd's shutdown order?

Is there a way to get systemd to tell me the rough order in which it will shutdown services when I cleanly shut the whole system down? Since systemd will shut things down in parallel, I appreciate there is no way to know the exact order, but it…
Adam Spiers
  • 570
  • 1
  • 4
  • 13
12
votes
1 answer

How to properly permanent enable ip forwarding in Linux with systemd?

I try to enable ip forwarding (between enp0s3 and tun0 interfaces) and write net.ipv4.ip_forward = 1 in /etc/sysctl.conf. After restart I have $ cat /proc/sys/net/ipv4/ip_forward 1 But forwarding still not working. I try to add…
Unsacrificed
  • 171
  • 1
  • 1
  • 7