Questions tagged [systemd-service]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
16 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 ...
2
votes
2answers
149 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
1answer
39 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
1answer
30 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
1answer
33 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 ...
0
votes
2answers
77 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 ...
1
vote
2answers
36 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 ...
0
votes
0answers
63 views

Systemd: Type=forking vs. PIDFile

After the Unix admins enabled the systemd --user for our application's account, I created the following service-template (itself generated from an Ansible-template first, as you may notice -- because ...
0
votes
1answer
367 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 ...
0
votes
0answers
375 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 ...
0
votes
2answers
166 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
0answers
42 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 ...
0
votes
1answer
151 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
1answer
690 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
1answer
48 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
1answer
41 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
1answer
176 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
1answer
501 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 ...
1
vote
0answers
368 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
2answers
324 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 ...
0
votes
1answer
74 views

systemd service fails to authenticate scp between two servers

I have written a service that triggers a shell script to backup a postgres database, on a CentOS7 server. It dumps the backup file into the /tmp/ folder and then it is supposed to copy the file across ...
2
votes
1answer
120 views

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....
0
votes
1answer
227 views

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?
1
vote
2answers
1k views

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 ...