Questions tagged [systemd-service]
The systemd-service tag has no usage guidance.
54
questions
0
votes
0
answers
19
views
How to ensure that system-userdbd.service is started after root fs became writeable without creating circular dependencies?
I have a fast virtual machine and the systemd service systemd-zserdbd.service fails with
Dec 01 17:45:32 server-new systemd[1]: Starting systemd-remount-fs.service...
...
Dec 01 17:45:32 server-new (...
1
vote
0
answers
49
views
Systemd service with DynamicUser cannot write to its CacheDirectory
I'm running OpenSuse Leap 15.4.
I have created a unit file for the bazel-remote remote cache server, for the Bazel build system.
I wanted to use the DynamicUser feature to make the service more secure,...
0
votes
0
answers
42
views
Systemd sequencial stop of template unit instances
I have a template unit that that I have to created in order to start/stop some services running an a given port. something like [email protected], se[email protected].
[Unit]
After=network.target
...
0
votes
1
answer
808
views
How can I find the exact cause of systemd service unable to start (service has a bad unit file setting)?
This is really annoying that systemd only responded that my configuration of a service file is wrong, but does not specify where is wrong exactly:
/lib/systemd/system/auto_pgha.service:
[Unit]
...
1
vote
2
answers
105
views
Why doesn't systemd capture output from subprocesses of a user service written in shell script?
Here is my amazing service, written in shell script:
$ cat ~/junk/demoapp
#! /bin/bash -eu
while true
do
echo "in shell"
( echo "in subshell" )
/usr/bin/echo "in ...
0
votes
1
answer
136
views
How can I connect standard output and error of a systemd service to a file with a date in the path?
I would like to run a server process under systemd, and append its standard output and error to a file, where the file path has a date in it, like this:
/initech/logs/tps-report-app/sales/2023/09/11/...
0
votes
1
answer
267
views
Is it possible to set CPUAffinity=0 for a specific process in its systemd service unit file?
Is it possible to set CPUAffinity=0 for a specific process (lets say httpd.service) in its systemd service unit file?
1
vote
1
answer
61
views
Setting MAINPID from podman container
I'd like to send a systemd notification with readiness and main pid. Unfortunately, it seems like systemd doesn't cope with translating pids from different namespaces. (Just a guess...)
Specifically, ...
1
vote
1
answer
128
views
Why echo text won't work within systemd service
This bash script worked fine alone:
#!/bin/bash
OtherIP=172.17.1.2
while [ true ]
do
echo "cannot connect to $OtherIP" >>pgha.log
sleep 2s
psql -h $OtherIP -U checker -c '\l' ...
0
votes
0
answers
61
views
Is it possible to delay a systemd service indefinitely by "After" clause?
Currently I am working on this issue:
Service 1 is on another machine.
Service 2 is on this machine but need Service 1 available to function.
Service 3 is on this machine but need Service 2 to ...
0
votes
1
answer
85
views
service file disappeared in Google CLoud VM
I have a Google VM micro instance running Ubuntu 20.04. Last week on this VM, I set up a systemd service that runs a python script. I created the service file (say my_fancy_service.service) as /lib/...
0
votes
0
answers
437
views
Systemd service file location for locally-built software
This might be a mostly aesthetic problem, but it's been bugging me enough to put a little more effort into resolving it.
In my work environment, we rely very heavily on in-house developed software for ...
1
vote
1
answer
139
views
systemd timer job not working
I want the job to run every day at 2am and 2pm
I have this in the .timer file
OnCalendar=*-*-* 02:00:00,14:00:00
But when I systemctl start myjob.timer I get this error:
Failed to start myjob.timer: ...
1
vote
1
answer
342
views
Why qemu fails to start host only network on loopback when there's no other network on host?
Starting qemu-system-x86_64 with -nic user,ipv6=off,hostfwd=tcp::9022-:22
With only the lo interface (with 127.0.0.1 associated to it) present on the host, the vm will start, but any daemon trying to ...
0
votes
1
answer
142
views
Possible to write a systemd service that starts when another service starts?
This seems like it should be a really simple question but I have had no luck in figuring it out. I have a service 'Alice':
[Unit]
Description=Alice
After=network.target
[Service]
Type=simple
Restart=...
0
votes
0
answers
634
views
Debian Failed at step EXEC spawning - Systems Service - Permission Denied
I'm following this tutorial exactly line by line:
https://docs.meilisearch.com/learn/cookbooks/running_production.html#step-4-run-meilisearch-as-a-service
It has a step to setup the Meilisearch as a ...
0
votes
1
answer
255
views
Systemd: why are files in /tmp or /run deleted after a few seconds?
I am using systemd to mount a Windows share using Kerberos. To make this work, I first run kinit in a .service file to create a Kerberos credential cache (ccache). The .service runs as root as the ...
0
votes
1
answer
393
views
How to monitor systemd?
I am looking for a way to monitor systemd services: Basic things such as whether they are running or not is a good start (and anything else on top is a bonus).
I tried using node_exporter, but since I ...
1
vote
2
answers
415
views
Limit systemd service manual restart rate
I have a system where a service (nginx for example) is sometimes restarted excessively by 'systemd restart nginx' (as result from other scripts, eg. to apply a new configuration or rotate logs).
Even ...
1
vote
0
answers
18
views
Marking services for killing in a resource-starvation situation
We use systemd --user to run certain services of our own. In some cases, these "get out of hand" -- spawn way too many processes, which exhausts RAM and causes the machine to "thrash&...
0
votes
1
answer
151
views
systemd string formatting for instance parameter
I'm trying to set up a systemd service that takes a parameter, and uses it in a couple places. I think I'm very close: with my config file name myservic[email protected], I can run systemctl start myservice@...
0
votes
1
answer
320
views
Custom systemd unit fails to start gnu screen and fork to background
I am trying to make systemd unit that starts a script inside GNU screen headlessly. I did base my work here on a couple of questions some had that were related. I also tested the ExecStart line in a ...
0
votes
0
answers
714
views
Ubuntu 20.04 Power LTS: How to disable "multipathd" service at boot time, from the petitboot shell?
Setup:
I have large number of multipath LUNs from SAN, connected to this system. Most of these LUNs are not formatted for the Linux env and needs to be reformatted before using.
The Problem:
To work ...
0
votes
1
answer
1k
views
Systemd NetworkNamespacePath not working
I'm trying to launch an app inside a network namespace from a systemd service. I tried using NetworkNamespacePath= but when I use it all network requests fail. If I launch the app in ExecStart using ...
0
votes
0
answers
274
views
Can a bash script detect if it's **not** being run inside a `systemd` service?
I have a bash script. This script can be started as part of a systemd service (or transient systemd task with systemd-run). One can also run it stand alone.
How can I see if “the current script” is ...
0
votes
0
answers
273
views
Systemctl reports service failed after user manually restarted Apache. Can systemd and reality be synched without restarting processes?
I have an Apache instance that starts with a systemd unit. A user manually stopped and restarted the instance. Now systemctl reports the service as "failed". Other than stopping and ...
0
votes
1
answer
2k
views
Is it possible for a systemd service to update itself?
Hey faultless server folks,
I'd like to write a systemd service that can update itself.
Specifically, every 5 minutes it should look at Amazon S3 for new versions of its binary and .service files.
If ...
1
vote
0
answers
2k
views
Run two scripts one after another with a systemd service
I have two scripts, what I would like to do is:
at 1am, the first one runs
once the first one stops, and this is a condition, the second one fires
So, should i use:
[Service]
ExecStartPre = script....
1
vote
1
answer
3k
views
Run Systemd Service After Display Manager
I have a script that changes some Gnome settings which I want to run on startup. The script itself works fine when I run it manually, but I get the following error when I run it as a systemd service:
●...
7
votes
1
answer
3k
views
Show a systemd unit file with its overrides merged in
systemctl cat myunit.service prints the contents of the main myunit.service file followed by any override files. Is there a way to print the unit file that systemd will actually use, i.e. the one ...
0
votes
0
answers
4k
views
redhat linux 8 systemd service error 203
Deployed a sample dot net core web api to EC2 instance in /var/www/hello-app folder using the user “ec2-user” in FileZilla
The folder contains the required dlls and other dotnet files
Installed ...
2
votes
1
answer
417
views
Is it possible to use both `After=` and `Before=` options towards the same unit (service) together in systemd service?
The Type=oneshot unit A.service is started hourly by A.timer and it Wants=B.service, but runs Before=B.service. Unit B.service is also Type=oneshot. The requirement here is that their processes ...
5
votes
2
answers
10k
views
How can I run a systemd service after network link has been established?
A while ago I set up a systemd service to run after network comes online per the documentation.
This is the unit file:
[Unit]
Description=Refresh Pacman mirrorlist with Reflector.
Documentation=https:/...
0
votes
1
answer
4k
views
Tail the journalctl log on failure to restart systemd service?
I want to know if there is a brief way to check the last 50 lines about a service that threw an error on restart.
$ sudo service nginx restart
Job for nginx.service failed because the control process ...
0
votes
1
answer
231
views
nginx.service is not starting after mount
I have a nginx that depends on a mounted drive.
My nginx.service has an entry with the RequiresMountsFor in the service unit like this:
[Unit]
RequiresMountsFor=/media/bar
But looks like it is still ...
0
votes
1
answer
627
views
Verify in ExecStartPre if bash binary exists
I want my service to start only if another service is not active. To do so, as explained in this other question, I am going to do:
ExecStartPre=/bin/bash -xc '/usr/bin/systemctl is-active --quiet ...
1
vote
2
answers
2k
views
Can't write to /tmp in systemd service with PrivateTmp=true
My apache2 service has PrivateTmp=true. When the service first starts it works fine, but after a few days, writing to /tmp fails with "no such file or directory". To debug I've tried running ...
0
votes
2
answers
644
views
Howto create custom service in systemd?
Running Fedora 33/34 on multiple machines. I successfully activated rc-local.service which works fine. I have couple of other scripts that I need to run in /etc/init.d/ and I created similar service ...
2
votes
1
answer
8k
views
systemd service produces Exec format error
I have created the following systemd service to automatically keep an autossh tunnel open between two servers:
#Systemd unit file for autossh
[Unit]
Description=Autossh Tunnel
[Service]
Type=forking
...
3
votes
2
answers
6k
views
Systemd timer OnCalendar every minute ending with 5
With OnCalendar systemd timer i can create something like this to run every 5 minutes.
OnCalendar=*:0/5
Is it possible to run it at every minute ending at 5 (00:05, 00:15, 00:25...) only?
And/or at ...
1
vote
2
answers
2k
views
Restrict a user to only interact with a systemd service via Ansible
I want to have a user that is only able to start/stop/restart/status a service via an Ansible playbook.
The playbook looks like this:
host: my-server
remote_user: my-user
tasks:
- name: "Start ...
1
vote
0
answers
104
views
Generate systemd task on the fly
I'm writing a script to backup each mysql databases separately on from a mysql server, but instead of handling this inside the script I would like to rely on systemd to generate a backup job to get ...
11
votes
1
answer
47k
views
Systemd: how to start service after another service started
I have these two services, one is Google start up script service and second one is redis service, I want to start redis service once the startup script service is started and done, I have these ...
0
votes
2
answers
19k
views
Can't initialize Redis as a systemd service (supervised systemd) on Ubuntu Server 20.04.2
On Ubuntu Server 20.04, Redis (5.0.7) doesn't start after setting supervised systemd on /etc/redis/redis.conf, but no error is printed when running it manually with /usr/bin/redis-server /etc/redis/...
0
votes
1
answer
592
views
Using find -exec in systemd ExecStartPre
I think it's fairly obvious what I'm trying to do here
# Rename Log File
ExecStartPre=/bin/find /data/db/log/*.log -type f -exec mv {} {}.`date +"%Y%m%d-%H%M"` \;
# gzip past log files (is ...
0
votes
1
answer
223
views
systemd tmpfs shadow directory -- copy to/from ram and back when (u)mount-ing
I'd like to keep some directories (e.g. /var/cache/apt, /var/lib/apt/lists, user browser caches or even Mozilla profiles) in RAM, but still backed by disk. The files should be copied to RAM when ...
0
votes
1
answer
533
views
Systemd: Unlock drives before ZFS import
I have LUKS encrypted drives and ZFS on top of that. I unlock the drives on boot using a script. I made a systemd service for that, but the script take some time and the zfs-import-cache.service ...
0
votes
1
answer
3k
views
How to start a gnome-terminal with command from the systemd service on Ubuntu 20.04?
I wrote e service file called /etc/systemd/system/mytest.service . Then I would like to start a new terminal window with some commands that print on the new terminal console.
The file mytest.service ...
2
votes
0
answers
2k
views
why consul systemd service is failing?
This is my consul.service file.
[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online....
0
votes
2
answers
996
views
CentOS 7 systemd.exec configuration: alternatives to LogsDirectory & CacheDirectory?
On a CentOS Linux 7.8 system, if I create a systemd service configuration file and include LogsDirectory and/or CacheDirectory in the [Service] section, then do a systemctl daemon-reload, the ...