Questions tagged [systemd]

Systemd is a system management daemon designed for Linux. Use this tag for *programming questions* using systemd or its libraries. Questions about *configuring the daemon* (including writing unit files) are better directed to Unix & Linux: https://unix.stackexchange.com.

Systemd is a system management daemon designed for Linux and programmed exclusively for the Linux API. For systems using it, it is the first process which is executed in user space during the Linux startup process. Therefore, systemd serves as the root of the user space's process tree.

2384 questions
8
votes
1 answer

systemd adding service into multi-user.target.wants folder only works as a symlink

I have been adding some systemd services. I started off with my services being symlinks from: /etc/systemd/system/multi-user.target.wants/myservice.service -> /home/myservice.service This seems to work ok. but if I remove the symlink and make it a…
code_fodder
  • 15,263
  • 17
  • 90
  • 167
8
votes
1 answer

How to get systemd variables to survive a reboot?

I have a product provided by a third party vendor. It includes many services for which they provide initd style startup scripts. There is one script for each service provided. These scripts reference variables like JAVA_HOME, THE_PRODUCT_HOME and so…
GMc
  • 1,764
  • 1
  • 8
  • 26
8
votes
1 answer

How to run a specific program before systemd's watchdog stops a service

I have a program which is run by systemd with a service file like this: [Unit] Description=... [Service] Type=notify ExecStart=/usr/sbin/myprogram WatchdogSec=1 KillMode=process KillSignal=SIGTERM Restart=always It sends the respective signal to…
jotrocken
  • 2,263
  • 3
  • 27
  • 38
8
votes
1 answer

Run timer exactly every second with systemd

How to run some service exactly every second? Overlapping allowed. Here is my timer unit for systemd: [Unit] Description=Send jobs every…
Anton Medvedev
  • 3,393
  • 3
  • 28
  • 40
8
votes
2 answers

Docker container doesn't start after reboot with enabling systemd script

I have the following systemd script: [Unit] Description=Hub docker container After=docker.service [Service] User=root ExecStart=/home/hub/hub.sh ExecStop=/bin/docker stop hub ExecStopPost=/bin/docker rm…
chip
  • 155
  • 1
  • 1
  • 10
8
votes
2 answers

Strace daemon process started using service

Strace can be used for tracing process by passing command for the process as below strace -f -tt -o strace.log -D But below command fails to trace the syscalls of started daemon process strace -f -tt -o strace.log -D service nginx…
Yogesh
  • 4,546
  • 2
  • 32
  • 41
8
votes
2 answers

Why does `forever` mean this code doesn't read from a socket or print to stdout?

I have written a systemd socket activated service in Haskell. The idea is the service should be started automatically when a message is sent to its socket, the service should process all messages waiting on the socket and then exit. Note: the reason…
user4301448
  • 191
  • 10
8
votes
1 answer

How to load environment variables for the process of a systemd service?

i am developing some services scripts that need to be executed on boot on Raspbian (Jessie) and i decided to use systemd. I just started to read some quick tutorials on how to use it, but I have problems with the environment. The processes that are…
zovakk
  • 195
  • 1
  • 1
  • 11
8
votes
1 answer

Which one is PID1: /sbin/init or systemd

I'm using Arch Linux. I have read about systemd, and as I understand it, systemd is the first process, and it starts the rest of the processes. But when I use: ps -aux The result shows that /sbin/init has PID 1. And when I use: pstree -Apn The…
James
  • 99
  • 1
  • 1
  • 5
8
votes
4 answers

kestrel-hellomvc.service: Failed at step USER spawning /usr/bin/dotnet: No such process

I was following the tutorial https://learn.microsoft.com/en-us/aspnet/core/publishing/linuxproduction on publishing asp.net core project on Nginx, the previous steps all seem successful, but while systemctl start kestrel-hellomvc.service systemctl…
Wenfang Du
  • 8,804
  • 9
  • 59
  • 90
8
votes
1 answer

Journalctl. User unit's output disappears

I have a very simple SystemD user unit: ~/.config/systemd/user/logtest.service [Unit] Description=log test After=network.target [Service] Type=oneshot ExecStart=/home/andrey/tmp/1.sh [Install] WantedBy=default.target 1.sh is just…
Andrey Denisov
  • 158
  • 1
  • 7
8
votes
1 answer

How do I build a Spring Boot jarfile that systemd can execute directly as a service?

How do I build a Spring Boot jarfile that systemd can directly execute as a service? Following the example in Installation as a systemd service, I created the following systemd service that directly executes a Spring Boot…
Derek Mahar
  • 27,608
  • 43
  • 124
  • 174
8
votes
3 answers

What is SystemD's default value for LimitNOFILE (on CentOS7)

It seems like a very easy question but I couldn't find, what the default for services in SystemD for LimitNOFILE is. Is there a file with global defaults?
Martin Rauscher
  • 1,700
  • 1
  • 14
  • 20
8
votes
3 answers

Calling a sd_notify(0, "WATCHDOG=1") in a service

I have a sys d service. I want to implement a watch dog for that. It's something like, [Unit] Description=Watchdog example service [Service] Type=notify Environment=NOTIFY_SOCKET=/run/%p.sock ExecStartPre=-/usr/bin/docker kill…
pnv
  • 2,985
  • 5
  • 29
  • 36
8
votes
2 answers

Starting bottle web server through systemd?

I am trying to start a bottle web app I wrote using systemd. I made the file /etc/systemd/user/bottle.service with the following contents: [Unit] Description=Bottled fax…
user530873
  • 1,055
  • 9
  • 17