Questions tagged [systemd-service]
50 questions
7
votes
1 answer
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 following systemd config but my redis services won't…

Jack
- 181
- 1
- 1
- 4
6
votes
1 answer
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 formed from merging the overrides into the main unit?

Sean
- 175
- 1
- 6
5
votes
2 answers
Prevent a systemd service from starting if another systemd service is running
In systemd (v237 on UbuntuLinux 18.04 bionic), I can create a service file (for A.service), and specify another service Requisite=B.service. Meaning if I try to start A.service and B.service isn't already running, then A.service will not be started.…

Amandasaurus
- 31,471
- 65
- 192
- 253
4
votes
2 answers
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…

Evy Bongers
- 151
- 1
- 6
3
votes
2 answers
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 every minute ending with a 0 (00:00, 00:10,…

CrazyRabbit
- 439
- 4
- 13
3
votes
1 answer
How to list systemd services by memory usage
I'd like to see which systemd services consume the most amount of memory.
Is there a way to list all running (and/or enabled) systemd services by memory usage?

Newskooler
- 211
- 1
- 3
- 14
2
votes
1 answer
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 should never overlap at run time (oneshot ensures…

Alexander Shukaev
- 91
- 8
2
votes
1 answer
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
ExecStart=/usr/bin/autossh -M 20009 -f -N -L…

toom
- 217
- 1
- 5
- 12
2
votes
0 answers
why consul systemd service is failing?
This is my consul.service file.
[Unit]
Description="HashiCorp Consul - A service mesh…

Chang Zhao
- 132
- 1
- 9
2
votes
1 answer
Systemd Timer Template after boot?
I have a templated timer that calls a templated unit. I use the following to enable and start them:
sudo systemctl enable ping@.timer
sudo systemctl enable ping@service
sudo systemctl start ping@hello.timer
This works as expected, and the timer…

Spammy
- 41
- 4
1
vote
1 answer
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, I'm staring a service with:
ExecStart=podman run…

viraptor
- 1,296
- 6
- 21
- 41
1
vote
1 answer
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' template1 &>/dev/null
if [ $? -eq 0 ]; then
echo `date`…

George Y
- 528
- 6
- 16
1
vote
1 answer
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: Unit myjob.timer has a bad unit file…

guesty
- 63
- 5
1
vote
1 answer
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 allocate port 22 will hang. e.g. inside vm:…

gcb
- 344
- 1
- 4
- 18
1
vote
2 answers
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 when restarting a service "manually" this way,…

dronus
- 1,178
- 1
- 13
- 15