Skip to main content
118 votes
Accepted

Systemctl remove unit from failed list

Use systemctl to remove the failed status. To reset all units with failed status: systemctl reset-failed or just your specific unit: systemctl reset-failed [email protected]
sebasth's user avatar
  • 15.8k
42 votes

"Proper" way to run shell script as a daemon

Using systemd you should be able to run a script as a daemon by creating a simple unit. There are a lot of different options you can add but this is about as simple as you can get. Say you have a ...
johnramsden's user avatar
40 votes

What is the avahi daemon?

In short: avahi is a Linux implementation of a protocol also known as "Rendezvous" or "Bonjour"). Its goal is to let devices, connected to the local network, broadcast their IP-...
schweik's user avatar
  • 1,450
30 votes
Accepted

Why would I chroot for sandboxing for security if my application can from the beginning run at a lower level?

It seems that others have missed your point, which was not reasons why to use changed roots, which of course you clearly already know, nor what else you can do to place limits on dæmons, when ...
JdeBP's user avatar
  • 72k
28 votes

What does "systemctl daemon-reload" do?

If you change /lib/systemd/system/<servicename>.service and restart via systemctl restart <servicename>.service it will not load the new settings unless you do a systemctl daemon-reload. ...
MortenB's user avatar
  • 413
23 votes

rsync port 22 and 873 use

You can use parameter -e to specify the ssh port, e.g. rsync -rvz -e 'ssh -p $port' ./dir user@host:/path
user674158's user avatar
23 votes
Accepted

Double fork() - why?

The following paragraphs, quoted from Stevens and Rago Advanced Programming in the UNIX Environment, describe two of six coding rules for writing a daemon. Specifically, they implement them in a ...
don_aman's user avatar
  • 1,488
22 votes
Accepted

rsync port 22 and 873 use

For context, the rsync documentation says There are two different ways for rsync to contact a remote system: using a remote-shell program as the transport (such as ssh or rsh) or ...
Stephen Kitt's user avatar
22 votes

Why do daemons only read their configuration file when they start up? Why can't they "react" to changes in that file/hot reload?

There are multiple reasons. One major reason is that many daemons have multiple configuration files, and any single file change might not be usable on its own — so having a daemon attempt to reload ...
Stephen Kitt's user avatar
21 votes
Accepted

How to set OOM killer adjustments for daemons permanently?

Several modern dæmon supervision systems have a means for doing this. (Indeed, since there is a chain loading tool for the job, arguably they all have a means for doing this.) Upstart: Use oom ...
JdeBP's user avatar
  • 72k
19 votes
Accepted

How do you make a process a service under systemd?

An example of a user service is the easiest way to describe how to do this. Let's assume that you have a binary or a script, called mytask, that you want to run as a service, and it is located in /usr/...
Greenonline's user avatar
  • 1,973
15 votes

Recommended way for a Linux app to inform user of an exception

First of all, not all errors are equal. "The username and password you are using to authenticate were rejected by the remote server" is quite different than "The machine is out of ...
Ángel's user avatar
  • 3,814
14 votes

"Proper" way to run shell script as a daemon

I am probably missing something here; why exactly wouldn't nohup be appropriate? Of course it's not enough alone, but supplementing it seems straightforward. #!/bin/bash if [ "$1" = "...
LSerni's user avatar
  • 4,695
12 votes

Which PID belongs into the systemd PIDFile section when creating a shell script daemon?

So the problem you're seeing here is because when Type=forking is in use, then the pid file must be created (with the correct pid) before the parent process exits. If you create the pidfile from the ...
filbranden's user avatar
  • 22.6k
11 votes

systemd not detected, dockerd daemon needs to be started manually

You will either need to log in with pam_systemd or enable user lingering for your user, then you can troubleshoot systemctl --user. To log in with pam_systemd (source) Try one of the following methods:...
griffinht's user avatar
  • 111
11 votes

Recommended way for a Linux app to inform user of an exception

due to unstable state of the app (SIGSEGV or SIGBUS may not have any recovery) I think it is still possible in a SIGSEGV handler to fork+exec a "crash handler" process (which then would ...
grawity's user avatar
  • 15.7k
11 votes

Recommended way for a Linux app to inform user of an exception

I'm going to try and directly answer the questions [I think] you're actually asking. How should a program handle UNIX signals? Generally speaking, it shouldn't. UNIX signals are a somewhat dated ...
Keiji's user avatar
  • 521
10 votes

Turn on bluetooth on login screen

By default, the Bluetooth adapter does not power on after a reboot. So, if you want to auto power-on after boot you need to add the line AutoEnable=true in the configuration file /etc/bluetooth/main....
Cirelli94's user avatar
  • 312
10 votes
Accepted

How do I stop daemonized OpenVPN connection?

Since OpenVPN does not seem to offer any function of its own for this, you are probably looking for pkill <process-name>, which will search for all processes matching the given name, and kill ...
ZleekWolf's user avatar
  • 750
10 votes
Accepted

Where to put daemon files?

There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html I would suggest: Sockets: /run/<subdir>/. That's because /var/run is just a ...
Philip Couling's user avatar
9 votes
Accepted

Systemd timeout because it doesn't detect daemon forking

Do not do that. At all. Any of it, either through a library function or rolling your own code. For any service management system. It has been a wrongheaded idea since the 1990s. Your dæmon is ...
JdeBP's user avatar
  • 72k
9 votes

How to view daemon stdout in openrc?

You can specify output_log, error_log or output_logger, error_logger.  So you can extend your service file to be #!/sbin/openrc-run command="python3" command_args="/srv/http/tornado.py&...
graywolf's user avatar
  • 971
9 votes

Recommended way for a Linux app to inform user of an exception

Modern desktop environments implement the notification dbus API, concretely org.freedesktop.Notifications.Notify. You can interact with that directly via dbus (which is an RPC standard used throughout ...
Marcus Müller's user avatar
8 votes

How to list all running daemons?

With a modern system running systemd (Debian based, Fedora, RedHat/CentOs, ...), the command systemctl is there to handle everything that is controlled by systemd. So to get a list of services, you ...
kebs's user avatar
  • 334
8 votes

How to properly enable httpd with rcctl on OpenBSD so that it starts automatically?

Your issue was that the httpd daemon was given an invalid command line argument (the string YES) when started using rcctl and therefore would not start properly. The only "special" value ...
Kusalananda's user avatar
  • 356k
8 votes
Accepted

What's the difference between consolekit and elogind?

Aside from the difference in maintainership pointed out by Ortomala Lokni (which I might add is only accurate for the original ConsoleKit, there is a fork called ConsoleKit2 which is actively ...
Austin Hemmelgarn's user avatar
8 votes

Why do daemons only read their configuration file when they start up? Why can't they "react" to changes in that file/hot reload?

Apart from all the other reasons mentioned in the other answers, there is a more deep, philosophical reason, and that is one of the fundamental Unix programming design principles: Do One Thing And Do ...
Jörg W Mittag's user avatar
8 votes

Does a process specified in systemd have to be a daemon?

Yes. Processes launched by service managers such as systemd run in dæmon context. But be aware of what being a dæmon actually means. To quote Bach: Processes in the UNIX system are either user ...
JdeBP's user avatar
  • 72k
8 votes

How to keep a script running persistently in background

the best method ... This depends on what you want to achieve. Just running in the background this one time: use nohup. Having it run as a service with automatic restart etc: use systemd. Want to run ...
Steffen Ullrich's user avatar
7 votes

Why would I chroot for sandboxing for security if my application can from the beginning run at a lower level?

I think many details of your question could apply equally to avahi-daemon, which I looked at recently. (I might have missed another detail that differs though). Running avahi-daemon in a chroot has ...
sourcejedi's user avatar
  • 53.6k

Only top scored, non community-wiki answers of a minimum length are eligible