Questions tagged [systemd-service]

50 questions
0
votes
1 answer

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 shell as the user it should start for, and it…
Kaizushi
  • 1
  • 1
0
votes
0 answers

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 on these newly attached LUNs, I freshly…
0
votes
0 answers

Auditd service mysteriously stopped after 2 minutes on Ubuntu

ubuntu:~$ systemctl status auditd ● auditd.service - Security Auditing Service Loaded: loaded (/lib/systemd/system/auditd.service; enabled; vendor preset: enabled) Active: inactive (dead) since Tue 2022-09-27 15:45:46 UTC; 1h 45min ago …
q85ts
  • 1
0
votes
0 answers

How to reduce duplication of configuration directives in systemd unit files?

Suppose I have two service units bar@%i.service and baz@%i.service which are both part of target unit foo@%i.target and share many common configuration directives, as seen below. (In reality, I have more than two service units.) #…
0
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
  • 101
0
votes
0 answers

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 being run as part of a systemd service? I can see…
Amandasaurus
  • 31,471
  • 65
  • 192
  • 253
0
votes
0 answers

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 restarting Apache, is there a way to get systemd to recognize…
iAmJeff
  • 21
  • 7
0
votes
1 answer

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 they've been updated, it should download and…
0
votes
0 answers

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 apache web server on the ec2 instance and started…
Sudhir Jangam
  • 111
  • 1
  • 2
0
votes
1 answer

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 exited with error code. See "systemctl status…
listenlight
  • 103
  • 2
  • 4
0
votes
1 answer

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 booting ahead of the mount point. My mount cmd…
0
votes
1 answer

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 other-unit.service && exit 1 || exit 0' However,…
mosquetero
  • 299
  • 2
  • 12
0
votes
2 answers

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 files as rc-local.service, but I can't enable…
DenisZ
  • 38
  • 7
0
votes
2 answers

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/redis.conf. Also, when running manually, its…
Paulo Coghi
  • 598
  • 2
  • 11
  • 22
0
votes
1 answer

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 post becuase might take a long time) ExecStartPost=/bin/find…
Loz
  • 1