Questions tagged [systemd-unit]

For questions about the design of systemd units, the relationships between units, and writing [Unit] and [Install] sections of systemd unit files. It can also be used for questions about units which do not have their own tag such as systemd targets.

Filter by
Sorted by
Tagged with
3 votes
1 answer
90 views

Managing ordering dependencies between systemd template instances

Abstracted example: I have two recurring tasks A and B that I want to setup as systemd services. As the tasks are quite similar to each other, I am using a template [email protected]; A and B will be ...
bluesheep's user avatar
0 votes
1 answer
20 views

send notification from one systemd unit to another with python?

I have a systemd unit 'my-app' that runs my main python app but I want it to auto-update when there is a new version on a remote server. The detection is watched by another python systemd unit (let's ...
16ar's user avatar
  • 13
5 votes
1 answer
265 views

How to specify dynamic "Environment" variables in a systemd unit file?

This $(ls -d...) does not work in a systemd unit file: [Service] Type=forking Environment="ORACLE_HOME=$(ls -d /usr/lib/oracle/*/client64 | sort -rV | head -n1)" Environment="TNS_ADMIN=$...
Sybil's user avatar
  • 1,833
0 votes
1 answer
31 views

systemd service fails to use `tail` to output to console

I fail to configure my systemd service properly (systemd 249.11-0ubuntu3.12). It should start a tail process which outputs to the console. Ubuntu running as Proxmox VM. When booting, the service is ...
Twonky's user avatar
  • 171
0 votes
1 answer
115 views

What exactly does it mean for a systemd service to be "activating"?

According to various clauses in the docs, the "activating" state is the transition between inactive states and an active state. So far so obvious. But how exactly is it defined? What ...
Atemu's user avatar
  • 689
0 votes
1 answer
42 views

Systemd executable failed to read file from CacheDirectory with Permission Denied

I have a Golang binary that runs every 5 mins. It is supposed to create & update a text file which needs to be write restricted. To run this binary I created a systemd service and a systemd timer ...
Korba's user avatar
  • 103
0 votes
0 answers
11 views

Systemd: temporary read-write folder in read-only file system

I have a system in which a single host can run multiple executions, which are sandboxed using systemd. The execution can specify which folder to be rooted in, e.g. RootDirectory=/var/images/some_root ...
alexlipa's user avatar
  • 101
0 votes
0 answers
39 views

systemd timers with long lived processes, avoiding overlaps

I have script that will scan for tasks, and work on one at a time to completion and then exit. Execution can last 1s (no tasks) to 2hours (heavy task). And subsequent runs should start as soon as ...
gcb's user avatar
  • 400
1 vote
1 answer
43 views

At boot, if X, then mount A, else mount B

Context is as in this other question of mine. TL,DR: most of my home folder is on an external drive that I carry along with me and mount at my various workplaces and at home. Mount is done as unionfs /...
L. Levrel's user avatar
  • 1,503
1 vote
1 answer
91 views

ping output sporadically missing (labeled as wrong unit) in journal of systemd service

I am using ping in a script, which runs in a systemd service unit. The output from ping is sometimes (often) missing in the unit's journal. I.e., it is missing from journalctl --user -u MyUnit. Note ...
dialer's user avatar
  • 121
0 votes
0 answers
32 views

systemd service startup order, but only on bootup

My use case is pretty similar to what is described in this question: Lots of custom services, not dependent on each other. On boot, they all start simultaneously and cause a peak in CPU and RAM load. ...
Attila Csipak's user avatar
0 votes
0 answers
51 views

systemd - Is this how to require a service by an installed program?

The essence: I want the systemd to symlink specific directories to /tmp/some_folder before it starts services from various installed packages and system services (like cups, pacman, etc.), the reason: ...
donaastor's user avatar
  • 214
0 votes
0 answers
19 views

A generator-like unit creates another unit, and both should be started during boot; is that possible?

Converting some old-style services using a configuration file to systemd units, I wrote a generator-like (i.e.: not actually a systemd generator) service that creates (depending on the configuration ...
U. Windl's user avatar
  • 1,411
3 votes
1 answer
173 views

Why systemctl status shows a time in the future and the amount of time left?

When we issue "systemctl status", we usually get in the output, a line showing the status and for how long it has been in that status. Like: (I issued that few minutes ago) Active: active (...
Travelling_Bird's user avatar
0 votes
0 answers
70 views

waylock - Trigger screenlocker on suspend, but not on hibernate?

The rationale is the same as in this question - since I'm already typing a disk encryption password on resume, I don't want to have to unlock my screen as well. I want the screen locker to only ...
Inglorion's user avatar
0 votes
1 answer
68 views

systemd: After=<a service that's activated by a systemd path unit>

Context I want A.service to be started only after B.service finishes starting up, and B.service is a unit that's activated by the corresponding systemd path unit: B.path. Relevant code snippets can be ...
David Chen's user avatar
1 vote
0 answers
43 views

How do I make sure that systemd targets start after the last one has completed?

I have t1.target and t2.target. I want to ensure that t2.target is only started after t1.target and all it's dependency services are completed. I have mocked this up for now but it does not seem to ...
user588629's user avatar
0 votes
0 answers
92 views

Systemd service wait wifi adapter to plug in

I have a systemd service that change MAC address every boot to wifi adapter. Systemd service works fine. I want this systemd service not wait 1m 30sec when the wifi adapter is not plug in the usb. I ...
user21379959's user avatar
0 votes
2 answers
152 views

Reorder of launching Systemd services

OS: Debian 11 Bullseye Context: The Zerotier application adds the zerotier-one.service system service and creates a virtual network interface (when it works). The sshd server default listens to all ...
DarekH's user avatar
  • 77
0 votes
2 answers
1k views

Unit templates and non-template destination units

I like to keep my custom unit files in their own directory away from /etc. In 247 this worked well, using something like the following: systemctl enable /path/to/unit.service This also worked with ...
Spammy's user avatar
  • 21
0 votes
1 answer
242 views

Run systemd timer even if process is still running

It has been confirmed that systemd timers won't start the .service if previous run hasn't finished. However, for unknown reason this blocks some Type=oneshot backup processes on my machine (they seem ...
Daniel Krajnik's user avatar
2 votes
1 answer
118 views

Ensure that systemd timer instances of same template are not running in parallel

I have a systemd timer template [email protected] and a corresponding service [email protected]. The job runs daily and has a generous RandomizedDelaySec of 2 hours. The job has many instances. Can I tell systemd ...
sedrubal's user avatar
  • 306
1 vote
1 answer
87 views

Systemd path PathExists= doesn't work if tracked file is deleted inside Unit=?

I have simple systemd.path restart.path: [Unit] Description= [Path] PathExists=/home/ubuntu/restart Unit=restart.service [Install] WantedBy=multi-user.target And the triggered restart.service ...
Azii's user avatar
  • 11
0 votes
2 answers
82 views

systemd unit "Before=" with timer

In my system I have b.service activated by b.timer. I want another service (a.service) that start before b.service. I cant change b.service or b.timer because are not mine. I've putte Before=b.service ...
Andrea Romano's user avatar
0 votes
1 answer
108 views

Bring systemd services up/down along with specific systemd service?

I have systemd: service1.service service2.service service3.service service1.service looks like: [Unit] Wants=service2.service service3.service After=service2.service service3.service [Service] ...
ojacomarket's user avatar
0 votes
3 answers
107 views

systemd.time - OnCalendar= unwanted running after suspend

I wanted a "more stupid" version of crontab: Run only on given times, don't catch up after suspension. I.e. when a service should have been triggered by crontab, but the machine was ...
DomX's user avatar
  • 1
0 votes
0 answers
59 views

systemd to control launch order for services

I have two systemd service files. I want gw_web.service to start after gw_log.service. Here are the two service files: gw_log.service: [Unit] Description=myGarage Log Service After=multi-user.target [...
gldrplt's user avatar
0 votes
3 answers
116 views

Many issues "(servicename) could not be found"

I've got issue in recently installed RHEL9.2. When looking at systemctl status -all I've got no failed units, but i see many red notices about missing services somehow inserted into middle of regular ...
AdamG's user avatar
  • 1
0 votes
1 answer
2k views

Why is systemd stopping my service immediately after start?

I am trying to build a custom service at the system level.  I have a script that runs successfully when run directly from the terminal.  This script activates a specific Conda environment and then ...
user571896's user avatar
0 votes
1 answer
143 views

do not run systemd service when another service ran sucessfully

I have two services for an application: healthcheck- which check the health of a system and attempts restart when the validation fails. rollback- when multiple restart attempts fails to pass the ...
sayan paul's user avatar
0 votes
1 answer
56 views

Start a systemd service after network but before other services

I want my service to start after network service but before all other services (eg. tomcat or mysql). I know about "Before=mysqld.service" option but I do not know all the names of the ...
aaa's user avatar
  • 1
0 votes
1 answer
138 views

Rsync script running manually but not via systemd service/timer

I've got a handful of bash scripts (all essentially clones of each other) which each does an rsync to a different dnf/yum repo to pull that repo down to our local mirror. The scripts all run correctly ...
Dulux-Oz's user avatar
0 votes
0 answers
209 views

Configuring a service unit to launch a bash script. Why is this failing?

I am asking systemd to supervise and control a process but for some reason, it is failing. Check the output at the end of the question I have a bash script in /usr/sbin/ros_diagnostics.sh that ...
UserK's user avatar
  • 2,424
3 votes
1 answer
442 views

Systemd will not enable this unit file, states "Invalid cross-device link" on the same file system

I have a Fedora 37 server I use for running my 3D printer farm. I have multiple instances of Klipper (3D printer firmware) running as individual systemd units along with other supplementary services ...
AtomicPorkchop's user avatar
0 votes
1 answer
146 views

Service ordering with a dependency on a conditional unit

On startup, service process_queue starts if ConditionDirectoryNotEmpty=/unfinished_queue_jobs, clears that directory, then stops. Service accept_new_jobs should start after process_queue completes, or ...
rgov's user avatar
  • 213
0 votes
1 answer
645 views

Make systemd treat unexpected exit as failure

I'm wrapping a 3rd party executable in a systemd service unit to manage it. I can't alter the behavior of this program and I don't really trust its exit codes. I would like to treat any exit that ...
davolfman's user avatar
  • 602
0 votes
0 answers
959 views

Running a simple command at startup in Fedora 37 using Systemd?

I simply want to execute a single command during startup, before any user logs in. (More precisely, I want to run a setkeycodes command to fix a quirk of my laptop's keyboard, so that it works ...
Thomas.M's user avatar
  • 131
4 votes
1 answer
969 views

Start request repeated too quickly

I am trying to make a periodic backup (OnCalendar=daily) to my dropbox via rclone. Since this runs on a laptop, I use Persistent=true. If I wake up the laptop, it takes a few seconds until the network ...
Manuel Schmidt's user avatar
1 vote
1 answer
3k views

systemd: Failed to start Application launched by gnome-session-binary

If you check the error log it comes to that .scope unit is not found - No such process. I got similar error 4 times. I would like to understand what is going on during the boot process. Why these ...
tukan's user avatar
  • 4,941
0 votes
0 answers
28 views

Failed to activate custom made systemd.service file [duplicate]

I created a bash script scriptToCreateFilesWithSystemD.sh to create a file inside a directory dir4systemDfiles Both have read-write access for all and located in home directory I added this code ...
Raj Parayane's user avatar
0 votes
1 answer
3k views

Systemd cannot exec a start command with error: No such file or directory, but the path is correct and permissions are correct aswell

So I have this modded minecraft server which has a launch script that is very simple and I wanted to control the server using systemd. Here is the launch script: #!/bin/sh # Server Launch Script # # ...
mux's user avatar
  • 1
1 vote
1 answer
542 views

Service OnFailure trigerred only after burst limit reached

I'm using a systemd unit file in order to control a python process running on a server (with systemd v247). This process must be restarted 60 seconds after it exits, either on failure or on success, ...
Arkaik's user avatar
  • 1,156
0 votes
0 answers
143 views

Systemd Service only works when restarted

I have a systemd service which runs a python script. The script opens a webpage, and then runs a http socket server to receive commands. When I reboot my raspberry pi (model 3 b v1.2) the service ...
Alex's user avatar
  • 1
0 votes
0 answers
129 views

How to add or modify systemd mount targets/conditions in unit file

I've got a .mount file that I globbed together as /etc/systemd/system/opt-hass-config.mount [Unit] Description=Mount the config dir of hass.mydomain.com [Mount] What=//[IP ADDRESS]/config Where=/opt/...
HilarieAK's user avatar
  • 101
0 votes
1 answer
178 views

systemd starts a service which has ordering after a disabled service

service B unit configuration (it is an oneshot service): [Unit] Description=Service B After=serviceA.service service A is disabled by default (it is a simple service) ● serviceA.service - service A ...
Chandrasekhar Raman's user avatar
4 votes
2 answers
200 views

Launch a node server then, when active, a web browser in systemd (Wayland)

I'm developing a web-based application, meant to run in an embedded Linux device. There are two parts I need to have launched when the device boots up: the node server (serving locally) and the cog ...
Aritz's user avatar
  • 123
1 vote
1 answer
713 views

How to check multiple host name in systemd unit condition

I'm trying to make a systemd service have a conditional start based on multiple hostname pattern. I've tried this without luck: root@linkbox-BI034415:/# systemctl cat mcbapp # /lib/systemd/system/...
Karsten Sperling Opdal's user avatar
2 votes
0 answers
375 views

Celery worker exited prematurely on restart using systemd

I'm using celery with systemd. I noticed that most times on restart, I lose the workers mid-task. From the celery multi documentation, it seems like the celery multi stopwait should be waiting for the ...
Ankit's user avatar
  • 71
0 votes
0 answers
214 views

systemd service

I'm wondering how services launched by means of systemd working. When system was running by means of System V init, there was scripts under runlevels (/etc/rc"level".d/) which described ...
siru's user avatar
  • 1
1 vote
1 answer
2k views

How to prevent SElinux from blocking custom systemd service at boot?

SElinux is preventing a custom service of mine from getting picked up by systemd at boot. MESSAGE=SELinux is preventing systemd from read access on the file custom.service before rebooting [root@box ...
Cory W.'s user avatar
  • 11