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
10
votes
3 answers

Python subprocess, realtime print with COLORS and save stdout

Printing the output of a subprocess while saving the result is not a new problem, and has been answered many times before e.g.: https://stackoverflow.com/a/28319191/5506400 This does not work for me because I am trying to maintain the shell colours…
run_the_race
  • 1,344
  • 2
  • 36
  • 62
10
votes
2 answers

how to name a mount unit file having dash

I have a mount unit file. "Where" directive is "Where=/Data/mnt-wt". How to name my .mount unit file? I read that '/' should be replaced with dash(-). Then dash should be replaced with what?
deepan muthusamy
  • 321
  • 2
  • 14
10
votes
2 answers

Systemd service B to start after another service A only if Service A exists

I have two systemd services A and B . I want B to get executed after A but only if A exists else just execute B .
Nayana Madhu
  • 1,185
  • 5
  • 17
  • 34
10
votes
1 answer

Why can't I stop my Mojo app using systemd?

I can fire up my Mojo app via systemd without any issues, but I can't stop or restart it in the same way. I've poached my config mostly from the Mojo docs at…
oalders
  • 5,239
  • 2
  • 23
  • 34
10
votes
1 answer

Adding a shell command inside/inline of a systemd service file

I am running the gunicorn server as a service via systemd, Here is the sample service file: [Unit] Description=Gunicorn NGINX After=network.target [Service] User=root Group=www-data WorkingDirectory=/test ExecStart=/usr/local/bin/gunicorn --workers…
10
votes
1 answer

Systemctl - Failed at step Group spawning

I have a problem with automatic running of service. I would like to run a script after user login. Once I have succeeded, however when I tried to automatize it, I'm getting an error and I can't find a mistake. Service: Description=Service…
JiangHongTiao
  • 858
  • 2
  • 8
  • 29
10
votes
1 answer

How do I create a systemd service that doesn't start on reboot?

I want to create a systemd service which I can start manually by using systemctl start but I don't want it to run automatically when the system reboots. How do I do this?
babueverest
  • 443
  • 1
  • 6
  • 17
10
votes
2 answers

systemd script - environment file updated by ExecStartPre

I am trying out systemd script along in Docker environment. Consider this: command mentioned in ExecStartPre updating environment file and ExecStart actually making use of environment variable mentioned in env. file.? (all in the same systemd…
kumar
  • 2,530
  • 6
  • 33
  • 57
10
votes
2 answers

caddy.service start request repeated too quickly

I'm using systemd to start a caddy webserver on an ubuntu 16.04 machine. Whenever I run sudo service caddy start and service caddy status, I get this error: ● caddy.service - Caddy webserver Loaded: loaded (/etc/systemd/system/caddy.service;…
ki9
  • 5,183
  • 5
  • 37
  • 48
10
votes
1 answer

Supervisor doesn't start on startup on Ubuntu 16.04

I installed Supervisor on Ubuntu 16.04 with the command: sudo apt-get install supervisor Supervisor 3.2.0-2 successfully installed and works if I run it with the command: sudo service supervisor start But after reboot it doesn't start…
Dmitry
  • 898
  • 10
  • 16
10
votes
2 answers

Forcing work directory when executing jar file in systemd

I am attempting to start a jar from a systemd service, in linux. The jar that I am executing assumes that within the current directory, there is an xml file. I am passing the name of that file, with the -config argument. The sample service I have…
angryip
  • 2,140
  • 5
  • 33
  • 67
10
votes
1 answer

systemd: How to use ExecStopPre in service files

Before my daemon is stopped I need to do call another program. My first try was to use ExecStopPre similar to ExecStartPre but according to https://bugs.freedesktop.org/show_bug.cgi?id=73177 this is not supported and I should use "multiple…
arved
  • 4,401
  • 4
  • 30
  • 53
10
votes
3 answers

how do I get etcd values into my systemd service on coreOS?

I have two services A and B. A sets a value in etcd as it's being started, say the public IP address which it gets from an environment file: ExecStartPost=/usr/bin/etcdctl set /A_ADDR $COREOS_PUBLIC_IPV4 B needs that value as it starts up, as well…
Mike Dewar
  • 10,945
  • 14
  • 49
  • 65
9
votes
1 answer

Accessing stdin during systemd boot

I have a script which solicits a numeric input from the user while booting the computer. The computer is running Fedora 16. It used work, on Fedora 13, but after the upgrade read INTEGER returns immediately, without catching any user input. I…
Mark C.
  • 1,773
  • 2
  • 16
  • 26
9
votes
1 answer

Why use ExecStart= (with no value) before another ExecStart=/new/value in a systemd override?

I would like to go the systemd override way to let dockerd to listen to port 2376. So I followed this instruction. On the other hand, I would like to dig into systemd to know what's going on under the hood. So I tried to inspect the unit file of…
krave
  • 1,629
  • 4
  • 17
  • 36