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]
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 ...
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-...
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 ...
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. ...
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
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 ...
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 ...
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 ...
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 ...
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/...
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 ...
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" = "...
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 ...
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:...
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 ...
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 ...
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....
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 ...
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 ...
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 ...
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&...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
daemon × 428systemd × 74
services × 60
linux × 56
debian × 36
process × 29
ubuntu × 27
sysvinit × 27
bash × 24
startup × 21
shell-script × 19
start-stop-daemon × 17
background-process × 15
init-script × 15
init × 14
centos × 13
shell × 11
python × 11
rhel × 10
arch-linux × 9
logs × 9
docker × 9
users × 9
ssh × 8
networking × 8