Questions tagged [systemd-service]

56 questions
20
votes
2 answers

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
  • 321
17
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
  • 285
6
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…
6
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
  • 33,461
4
votes
1 answer

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] Description=PostgreSQL High…
George Y
  • 618
  • 3
  • 11
  • 20
4
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,…
4
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
  • 231
  • 1
  • 4
  • 17
3
votes
2 answers

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 subprocess" sleep 1 done It produces some repetitive output: $…
3
votes
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,238
3
votes
1 answer

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 ip netns exec it works, but it's not very clean…
Fr3ddyDev
  • 131
2
votes
0 answers

VLC cannot resolve DNS of stream when run as systemd service

I am trying to run a simple stream redirect with VLC as a 24/7 service on a Debian 12 VM. I'm seeing the following error in the log output. Jan 28 20:15:10 iptv-vlc vlc[14523]: [hexid] main tls client debug: using tls client module "gnutls" Jan 28…
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…
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
  • 247
2
votes
0 answers

why consul systemd service is failing?

This is my consul.service file. [Unit] Description="HashiCorp Consul - A service mesh…
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
1
2 3 4